QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189304 | #2701. Impressive Integers | MahmoudAtia | WA | 1ms | 3568kb | C++14 | 1.4kb | 2023-09-27 09:57:29 | 2023-09-27 09:57:29 |
Judging History
answer
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, 0, 0, 1, -1, 1};
int dj[] = {0, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18;
const int N = 2e6 + 5, M = 1e4 + 5, MOD = 998244353;
#define EPS 1e-9
int n, m, k, h, w, x[N], y[N];
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//memset(dp, -1, sizeof dp);
cin >> n;
if (n == 1) {
cout << "1 1 1" << endl;
cout << "A 0 0 U";
return 0;
}
if (n == 2 || n == 3 || n == 5) return !(cout << "impossible");
if (n % 2 == 0) {
cout << 1 << " " << n - 1 << " " << n << endl;
for (int i = 0; i < n - 1; i++) {
cout << "A ";
if (i & 1) cout << i / 2 << " 1 D" << endl;
else cout << i / 2 << " 0 U" << endl;
}
cout << "B 0 1 U";
} else {
int c = (n - 4 + 1) / 2 * 2;
int b = (c - 2) / 2;
cout << 2 << " " << (c - 2) / 2 << " " << c << endl;
for (int i = 0; i < n - 4; i++) {
cout << "A ";
if (i & 1) cout << i / 2 * 2 << " 2 D" << endl;
else cout << i / 2 * 2 << " 0 U" << endl;
}
cout << "B 0 2 U" << endl;
cout << "B 0 " << 2 + b << " D" << endl;
cout << "B " << b << " 2 U" << endl;
cout << "B 0 " << 2 + b << " U";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
1
output:
1 1 1 A 0 0 U
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
2
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
3
output:
impossible
result:
ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3568kb
input:
4
output:
1 3 4 A 0 0 U A 0 1 D A 1 0 U B 0 1 U
result:
wrong answer Uncovered areas!