QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#233696 | #2701. Impressive Integers | Fyind | AC ✓ | 1ms | 3736kb | C++20 | 1.9kb | 2023-10-31 21:32:10 | 2023-10-31 21:32:10 |
Judging History
answer
#include <bits/stdc++.h>
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
using namespace std;
int main() {
#ifdef LLOCAL
freopen("a.in", "r", stdin);
#endif
int n;
cin >> n;
--n;
if (n == 0) {
cout << 1 << ' ' << 1 << ' ' << 1 << '\n';
cout << "A 0 0 U\n";
return 0;
}
if (n == 1 || n == 2 || n == 4) {
cout << "impossible\n";
return 0;
}
if (n % 2 == 0 && n % 4 != 0) {
int m = n / 4;
int a = 2, b = 2 * m - 1, c = 4 * m;
cout << a << ' ' << b << ' ' << c << endl;
int j = 0;
for (int i = c; i > 4 * m - 2; i -= a) {
for (int k = 0; k < i; k += a)
cout << 'A' << ' ' << k << ' ' << j << ' ' << 'U' << '\n';
j += a;
for (int k = 0; k < i - a; k += a)
cout << 'A' << ' ' << k << ' ' << j << ' ' << 'D' << '\n';
}
for (int i = 4 * m - 2; i > 0; i -= b) {
for (int k = 0; k < i; k += b)
cout << 'B' << ' ' << k << ' ' << j << ' ' << 'U' << '\n';
j += b;
for (int k = 0; k < i - b; k += b)
cout << 'B' << ' ' << k << ' ' << j << ' ' << 'D' << '\n';
}
// cout << 'B' << ' ' << 0 << ' ' << j << ' ' << 'U' << '\n';
return 0;
}
int a = 1, b, c;
if (n % 2 != 0)
c = (1 + n) / 2, b = (n - 1) / 2;
else
c = (2 + n / 2) / 2, b = (n / 2 - 2) / 2;
cout << a << ' ' << b << ' ' << c << '\n';
int j = 0;
for (int i = c; i > b; --i) {
for (int k = 0; k < i; ++k)
cout << 'A' << ' ' << k << ' ' << j << ' ' << 'U' << '\n';
++j;
for (int k = 0; k < i - 1; ++k)
cout << 'A' << ' ' << k << ' ' << j << ' ' << 'D' << '\n';
}
cout << 'B' << ' ' << 0 << ' ' << j << ' ' << 'U' << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
input:
1
output:
1 1 1 A 0 0 U
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
2
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
3
output:
impossible
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
4
output:
1 1 2 A 0 0 U A 1 0 U A 0 1 D B 0 1 U
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
5
output:
impossible
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
6
output:
1 2 3 A 0 0 U A 1 0 U A 2 0 U A 0 1 D A 1 1 D B 0 1 U
result:
ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
7
output:
2 1 4 A 0 0 U A 2 0 U A 0 2 D B 0 2 U B 1 2 U B 0 3 D B 0 3 U
result:
ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
8
output:
1 3 4 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 0 1 D A 1 1 D A 2 1 D B 0 1 U
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
9
output:
1 1 3 A 0 0 U A 1 0 U A 2 0 U A 0 1 D A 1 1 D A 0 1 U A 1 1 U A 0 2 D B 0 2 U
result:
ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
2
output:
impossible
result:
ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
10
output:
1 4 5 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 0 1 D A 1 1 D A 2 1 D A 3 1 D B 0 1 U
result:
ok
Test #12:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
11
output:
2 3 8 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 0 2 D A 2 2 D A 4 2 D B 0 2 U B 3 2 U B 0 5 D B 0 5 U
result:
ok
Test #13:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
12
output:
1 5 6 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 0 1 D A 1 1 D A 2 1 D A 3 1 D A 4 1 D B 0 1 U
result:
ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
13
output:
1 2 4 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 0 1 D A 1 1 D A 2 1 D A 0 1 U A 1 1 U A 2 1 U A 0 2 D A 1 2 D B 0 2 U
result:
ok
Test #15:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
14
output:
1 6 7 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 0 1 D A 1 1 D A 2 1 D A 3 1 D A 4 1 D A 5 1 D B 0 1 U
result:
ok
Test #16:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
15
output:
2 5 12 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 0 2 D A 2 2 D A 4 2 D A 6 2 D A 8 2 D B 0 2 U B 5 2 U B 0 7 D B 0 7 U
result:
ok
Test #17:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
16
output:
1 7 8 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 0 1 D A 1 1 D A 2 1 D A 3 1 D A 4 1 D A 5 1 D A 6 1 D B 0 1 U
result:
ok
Test #18:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
70
output:
1 34 35 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 33 ...
result:
ok
Test #19:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
80
output:
1 39 40 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 33 ...
result:
ok
Test #20:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
90
output:
1 44 45 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 33 ...
result:
ok
Test #21:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
6
output:
1 2 3 A 0 0 U A 1 0 U A 2 0 U A 0 1 D A 1 1 D B 0 1 U
result:
ok
Test #22:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
100
output:
1 49 50 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 33 ...
result:
ok
Test #23:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
998
output:
1 498 499 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #24:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
999
output:
2 497 996 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 32 0 U A 34 0 U A 36 0 U A 38 0 U A 40 0 U A 42 0 U A 44 0 U A 46 0 U A 48 0 U A 50 0 U A 52 0 U A 54 0 U A 56 0 U A 58 0 U A 60 0 U A 62 0 U A 64 0 ...
result:
ok
Test #25:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
1000
output:
1 499 500 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #26:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
788
output:
1 393 394 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #27:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
262
output:
1 130 131 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #28:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
714
output:
1 356 357 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #29:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
945
output:
1 235 237 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #30:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
35
output:
2 15 32 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 0 2 D A 2 2 D A 4 2 D A 6 2 D A 8 2 D A 10 2 D A 12 2 D A 14 2 D A 16 2 D A 18 2 D A 20 2 D A 22 2 D A 24 2 D A 26 2 D A 28 2 D B 0 2 U B 15 2 U B 0 17...
result:
ok
Test #31:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
414
output:
1 206 207 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #32:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
263
output:
2 129 260 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 32 0 U A 34 0 U A 36 0 U A 38 0 U A 40 0 U A 42 0 U A 44 0 U A 46 0 U A 48 0 U A 50 0 U A 52 0 U A 54 0 U A 56 0 U A 58 0 U A 60 0 U A 62 0 U A 64 0 ...
result:
ok
Test #33:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
39
output:
2 17 36 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 32 0 U A 34 0 U A 0 2 D A 2 2 D A 4 2 D A 6 2 D A 8 2 D A 10 2 D A 12 2 D A 14 2 D A 16 2 D A 18 2 D A 20 2 D A 22 2 D A 24 2 D A 26 2 D A 28 2 D A 30 ...
result:
ok
Test #34:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
527
output:
2 261 524 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 32 0 U A 34 0 U A 36 0 U A 38 0 U A 40 0 U A 42 0 U A 44 0 U A 46 0 U A 48 0 U A 50 0 U A 52 0 U A 54 0 U A 56 0 U A 58 0 U A 60 0 U A 62 0 U A 64 0 ...
result:
ok
Test #35:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
355
output:
2 175 352 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 32 0 U A 34 0 U A 36 0 U A 38 0 U A 40 0 U A 42 0 U A 44 0 U A 46 0 U A 48 0 U A 50 0 U A 52 0 U A 54 0 U A 56 0 U A 58 0 U A 60 0 U A 62 0 U A 64 0 ...
result:
ok
Test #36:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
285
output:
1 70 72 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 33 ...
result:
ok
Test #37:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
567
output:
2 281 564 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 32 0 U A 34 0 U A 36 0 U A 38 0 U A 40 0 U A 42 0 U A 44 0 U A 46 0 U A 48 0 U A 50 0 U A 52 0 U A 54 0 U A 56 0 U A 58 0 U A 60 0 U A 62 0 U A 64 0 ...
result:
ok
Test #38:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
154
output:
1 76 77 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 33 ...
result:
ok
Test #39:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
550
output:
1 274 275 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #40:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
528
output:
1 263 264 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #41:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
857
output:
1 213 215 A 0 0 U A 1 0 U A 2 0 U A 3 0 U A 4 0 U A 5 0 U A 6 0 U A 7 0 U A 8 0 U A 9 0 U A 10 0 U A 11 0 U A 12 0 U A 13 0 U A 14 0 U A 15 0 U A 16 0 U A 17 0 U A 18 0 U A 19 0 U A 20 0 U A 21 0 U A 22 0 U A 23 0 U A 24 0 U A 25 0 U A 26 0 U A 27 0 U A 28 0 U A 29 0 U A 30 0 U A 31 0 U A 32 0 U A 3...
result:
ok
Test #42:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
507
output:
2 251 504 A 0 0 U A 2 0 U A 4 0 U A 6 0 U A 8 0 U A 10 0 U A 12 0 U A 14 0 U A 16 0 U A 18 0 U A 20 0 U A 22 0 U A 24 0 U A 26 0 U A 28 0 U A 30 0 U A 32 0 U A 34 0 U A 36 0 U A 38 0 U A 40 0 U A 42 0 U A 44 0 U A 46 0 U A 48 0 U A 50 0 U A 52 0 U A 54 0 U A 56 0 U A 58 0 U A 60 0 U A 62 0 U A 64 0 ...
result:
ok