QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189307 | #2701. Impressive Integers | MahmoudAtia | AC ✓ | 2ms | 5496kb | C++14 | 1.4kb | 2023-09-27 10:09:26 | 2023-09-27 10:09:30 |
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 / 2 - 1 << " " << n / 2 << 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: 0ms
memory: 3456kb
input:
1
output:
1 1 1 A 0 0 U
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
3
output:
impossible
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3536kb
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: 3532kb
input:
5
output:
impossible
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3448kb
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: 0
Accepted
time: 0ms
memory: 3532kb
input:
7
output:
2 1 4 A 0 0 U A 0 2 D A 2 0 U B 0 2 U B 0 3 D B 1 2 U B 0 3 U
result:
ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
8
output:
1 3 4 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U B 0 1 U
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3384kb
input:
9
output:
2 2 6 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U B 0 2 U B 0 4 D B 2 2 U B 0 4 U
result:
ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
2
output:
impossible
result:
ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
10
output:
1 4 5 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U B 0 1 U
result:
ok
Test #12:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
11
output:
2 3 8 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U B 0 2 U B 0 5 D B 3 2 U B 0 5 U
result:
ok
Test #13:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
12
output:
1 5 6 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U B 0 1 U
result:
ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
13
output:
2 4 10 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U B 0 2 U B 0 6 D B 4 2 U B 0 6 U
result:
ok
Test #15:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
14
output:
1 6 7 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U B 0 1 U
result:
ok
Test #16:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
15
output:
2 5 12 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U B 0 2 U B 0 7 D B 5 2 U B 0 7 U
result:
ok
Test #17:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
16
output:
1 7 8 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U B 0 1 U
result:
ok
Test #18:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
70
output:
1 34 35 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17 0...
result:
ok
Test #19:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
80
output:
1 39 40 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17 0...
result:
ok
Test #20:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
90
output:
1 44 45 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17 0...
result:
ok
Test #21:
score: 0
Accepted
time: 0ms
memory: 3396kb
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 #22:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
100
output:
1 49 50 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17 0...
result:
ok
Test #23:
score: 0
Accepted
time: 2ms
memory: 3448kb
input:
998
output:
1 498 499 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #24:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
999
output:
2 497 996 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #25:
score: 0
Accepted
time: 0ms
memory: 5496kb
input:
1000
output:
1 499 500 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #26:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
788
output:
1 393 394 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #27:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
262
output:
1 130 131 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #28:
score: 0
Accepted
time: 2ms
memory: 3472kb
input:
714
output:
1 356 357 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #29:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
945
output:
2 470 942 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #30:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
35
output:
2 15 32 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U B 0 2 U B 0 17 D B 15 2...
result:
ok
Test #31:
score: 0
Accepted
time: 1ms
memory: 3392kb
input:
414
output:
1 206 207 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #32:
score: 0
Accepted
time: 1ms
memory: 3376kb
input:
263
output:
2 129 260 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #33:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
39
output:
2 17 36 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 32 ...
result:
ok
Test #34:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
527
output:
2 261 524 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #35:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
355
output:
2 175 352 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #36:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
285
output:
2 140 282 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #37:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
567
output:
2 281 564 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #38:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
154
output:
1 76 77 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17 0...
result:
ok
Test #39:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
550
output:
1 274 275 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #40:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
528
output:
1 263 264 A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U A 2 1 D A 3 0 U A 3 1 D A 4 0 U A 4 1 D A 5 0 U A 5 1 D A 6 0 U A 6 1 D A 7 0 U A 7 1 D A 8 0 U A 8 1 D A 9 0 U A 9 1 D A 10 0 U A 10 1 D A 11 0 U A 11 1 D A 12 0 U A 12 1 D A 13 0 U A 13 1 D A 14 0 U A 14 1 D A 15 0 U A 15 1 D A 16 0 U A 16 1 D A 17...
result:
ok
Test #41:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
857
output:
2 426 854 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok
Test #42:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
507
output:
2 251 504 A 0 0 U A 0 2 D A 2 0 U A 2 2 D A 4 0 U A 4 2 D A 6 0 U A 6 2 D A 8 0 U A 8 2 D A 10 0 U A 10 2 D A 12 0 U A 12 2 D A 14 0 U A 14 2 D A 16 0 U A 16 2 D A 18 0 U A 18 2 D A 20 0 U A 20 2 D A 22 0 U A 22 2 D A 24 0 U A 24 2 D A 26 0 U A 26 2 D A 28 0 U A 28 2 D A 30 0 U A 30 2 D A 32 0 U A 3...
result:
ok