QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189013 | #2701. Impressive Integers | triplem5ds# | WA | 1ms | 3556kb | C++23 | 2.6kb | 2023-09-26 19:06:11 | 2023-09-26 19:06:11 |
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 a = 1;
int b = 1;
int c = (n - 4 + 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();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3480kb
input:
1
output:
1 1 1 A 0 0 U
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3436kb
input:
2
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
3
output:
impossible
result:
ok
Test #4:
score: 0
Accepted
time: 1ms
memory: 3556kb
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: 3516kb
input:
5
output:
impossible
result:
ok
Test #6:
score: 0
Accepted
time: 1ms
memory: 3472kb
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: 3432kb
input:
7
output:
1 1 2 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 Triangle not contained within large triangle!