QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189009 | #2701. Impressive Integers | triplem5ds# | WA | 0ms | 3808kb | C++23 | 2.6kb | 2023-09-26 18:54:36 | 2023-09-26 18:54:36 |
Judging History
answer
/// Msaa el 5ra
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll
using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;
const int N = 5e5 + 5, LG = 18, MOD = 1e9 + 7;
const long double PI = acos(-1);
const long double EPS = 1e-7;
int n, m, k;
int solveStack(vector<int> vec) {
int ans = n * m + 1;
deque<int> dq;
int cur = 0;
f(i, 0, vec.size()) {
if (i && (vec[i] & 1) != (vec[i - 1] & 1)) {
dq.clear();
cur = 0;
}
cur += 1;
while (dq.size() && dq.front() == i - k)dq.pop_front();
while (dq.size() && vec[dq.back()] < vec[i])dq.pop_back();
dq.push_back(i);
if (cur >= k) {
ans = min(ans, vec[dq.front()]);
}
}
return ans;
}
void doWork() {
int n;
cin >> n;
if (n == 2 || n == 3 || n == 5) {
cout << "impossible\n";
return;
}
if (n == 1) {
cout << "1 1 1\n";
cout << "A 0 0 U\n";
return;
}
if (n % 2 == 0) {
int c = n / 2;
int a = 1;
int b = c - 1;
cout << a << ' ' << b << ' ' << c << '\n';
int x = 0, y = 0;
f(i, 0, n - 1) {
cout << "A " << x << ' ' << (i & 1) << ' ';
if (i % 2 == 0)cout << "U\n";
else cout << "D\n";
if (i % 2 == 1)x += 1;
}
cout << "B 0 1 U\n";
} else {
int c = ((n - 4) + 3) / 2;
int a = 1;
int b = (c - 1) / 2;
int x = 0;
cout << a << ' ' << b << ' ' << c << '\n';
f(i, 0, n - 4) {
cout << "A " << x << ' ' << (i & 1) << ' ';
if (i % 2 == 0)cout << "U\n";
else cout << "D\n";
if (i % 2 == 1)x += 1;
}
cout << "B " << 0 << ' ' << 1 << " U\n";
cout << "B " << 0 << ' ' << 1 + b << " D\n";
cout << "B " << b << ' ' << 1 << " U\n";
cout << "B " << 0 << ' ' << 1 + b << " U\n";
}
}
int32_t main() {
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
int t = 1;
// cin >> t;
while (t--) {
doWork();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
1
output:
1 1 1 A 0 0 U
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
2
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
3
output:
impossible
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4
output:
1 1 2 A 0 0 U A 0 1 D A 1 0 U B 0 1 U
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
5
output:
impossible
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
6
output:
1 2 3 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U B 0 1 U
result:
ok
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3548kb
input:
7
output:
1 1 3 A 0 0 U A 0 1 D A 1 0 U B 0 1 U B 0 2 D B 1 1 U B 0 2 U
result:
wrong answer Uncovered areas!