QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189260 | #2701. Impressive Integers | Beevo | AC ✓ | 1ms | 3612kb | C++20 | 1.7kb | 2023-09-27 05:44:00 | 2023-09-27 05:44:02 |
Judging History
answer
#include <bits/stdc++.h>
#define el '\n'
#define Beevo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
void testCase() {
int n;
cin >> n;
if (n == 2 || n == 3 || n == 5)
return cout << "impossible", void();
if (n == 1) {
cout << 1 << ' ' << 1 << ' ' << 1 << el;
cout << 'A' << ' ' << 0 << ' ' << 0 << ' ' << 'U';
return;
}
if (n & 1) {
cout << 2 << ' ' << (n - 5) / 2 << ' ' << n - 3 << el;
for (int i = 0; i < n - 4; i++) {
if (i & 1)
cout << 'A' << ' ' << i / 2 * 2 << ' ' << 2 << ' ' << 'D' << el;
else
cout << 'A' << ' ' << i / 2 * 2 << ' ' << 0 << ' ' << 'U' << el;
}
cout << 'B' << ' ' << 0 << ' ' << 2 << ' ' << 'U' << el;
cout << 'B' << ' ' << (n - 5) / 2 << ' ' << 2 << ' ' << 'U' << el;
cout << 'B' << ' ' << 0 << ' ' << 2 + (n - 5) / 2 << ' ' << 'D' << el;
cout << 'B' << ' ' << 0 << ' ' << 2 + (n - 5) / 2 << ' ' << 'U' << el;
}
else {
cout << 1 << ' ' << n / 2 - 1 << ' ' << n / 2 << el;
for (int i = 0; i < n - 1; i++) {
if (i & 1)
cout << 'A' << ' ' << i / 2 << ' ' << 1 << ' ' << 'D' << el;
else
cout << 'A' << ' ' << i / 2 << ' ' << 0 << ' ' << 'U' << el;
}
cout << 'B' << ' ' << 0 << ' ' << 1 << ' ' << 'U';
}
}
signed main() {
Beevo
int t = 1;
// cin >> t;
while (t--)
testCase();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
input:
1
output:
1 1 1 A 0 0 U
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3500kb
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: 1ms
memory: 3440kb
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: 3392kb
input:
5
output:
impossible
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3596kb
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: 3600kb
input:
7
output:
2 1 4 A 0 0 U A 0 2 D A 2 0 U 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: 3436kb
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: 3600kb
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 2 2 U B 0 4 D B 0 4 U
result:
ok
Test #10:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
2
output:
impossible
result:
ok
Test #11:
score: 0
Accepted
time: 1ms
memory: 3428kb
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: 1ms
memory: 3592kb
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 3 2 U B 0 5 D B 0 5 U
result:
ok
Test #13:
score: 0
Accepted
time: 0ms
memory: 3456kb
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: 3496kb
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 4 2 U B 0 6 D B 0 6 U
result:
ok
Test #15:
score: 0
Accepted
time: 0ms
memory: 3564kb
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: 1ms
memory: 3596kb
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 5 2 U B 0 7 D B 0 7 U
result:
ok
Test #17:
score: 0
Accepted
time: 0ms
memory: 3560kb
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: 0ms
memory: 3564kb
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: 0ms
memory: 3456kb
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: 3600kb
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: 1ms
memory: 3600kb
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: 0ms
memory: 3572kb
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: 1ms
memory: 3436kb
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: 1ms
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: 1ms
memory: 3604kb
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: 3460kb
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: 3560kb
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: 0ms
memory: 3612kb
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: 1ms
memory: 3496kb
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: 3452kb
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 15 2 U B 0 17...
result:
ok
Test #31:
score: 0
Accepted
time: 1ms
memory: 3444kb
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: 3444kb
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: 0ms
memory: 3448kb
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: 0ms
memory: 3608kb
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: 3508kb
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: 3428kb
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: 3444kb
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: 3548kb
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: 1ms
memory: 3568kb
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: 3556kb
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: 3568kb
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