QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#671795 | #5088. Two Choreographies | KowerKoint# | WA | 128ms | 26392kb | C++23 | 2.5kb | 2024-10-24 14:30:29 | 2024-10-24 14:30:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
int A[200000], B[200000];
vector<int> e[100000];
int doubling[100000][20];
int depth[100000];
set<pair<int, int>> used;
void calc(int i, int v) {
depth[i] = depth[v] + 1;
doubling[i][0] = v;
for (int j = 1; j < 20; j++) {
if (doubling[i][j - 1] == -1) {
doubling[i][j] = -1;
} else {
doubling[i][j] = doubling[doubling[i][j - 1]][j - 1];
}
}
used.insert({min(v, i), max(v, i)});
}
void dfs(int v) {
for (auto i : e[v]) {
if (doubling[i][0] != -2) continue;
calc(i, v);
dfs(i);
}
}
int lca(int a, int b) {
if (depth[a] < depth[b]) swap(a, b);
while (depth[a] > depth[b]) {
int j = 0;
int d = 1;
while (d * 2 <= depth[a] - depth[b]) {
j++;
d <<= 1;
}
a = doubling[a][j];
}
while (a != b) {
int j = 0;
while (doubling[a][j + 1] != doubling[b][j + 1]) j++;
a = doubling[a][j];
b = doubling[b][j];
}
return a;
}
int dist(int a, int b) {
return depth[a] + depth[b] - 2 * depth[lca(a, b)];
}
void print_path(int a, int b) {
int l = lca(a, b);
while (a != l) {
cout << a + 1 << " ";
a = doubling[a][0];
}
cout << l + 1;
vector<int> ans;
while (b != l) {
ans.push_back(b);
b = doubling[b][0];
}
reverse(ans.begin(), ans.end());
for (auto i : ans) cout << " " << i + 1;
}
int main() {
cin >> N;
for (int i = 0; i < 2 * N - 3; i++) {
cin >> A[i] >> B[i];
A[i]--;
B[i]--;
if (A[i] > B[i]) swap(A[i], B[i]);
e[A[i]].push_back(B[i]);
e[B[i]].push_back(A[i]);
}
for (int i = 0; i < N; i++) doubling[i][0] = -2;
for (int i = 0; i < N; i++) {
if (e[i].size() >= 3 && doubling[i][0] == -2) {
for (int j = 0; j < 20; j++) doubling[i][j] = -1;
calc(e[i][0], i);
calc(e[i][1], i);
calc(e[i][2], i);
dfs(e[i][0]);
dfs(e[i][1]);
dfs(e[i][2]);
dfs(i);
}
}
vector<int> inv_dist(N, -1);
for (int i = 0; i < 2 * N - 3; i++) {
if (used.contains({A[i], B[i]})) continue;
int d = dist(A[i], B[i]);
if (inv_dist[d] == -1) {
inv_dist[d] = i;
} else {
cout << d + 1 << endl;
// cerr << A[i] << " " << B[i] << " " << A[inv_dist[d]] << " " << B[inv_dist[d]] << endl;
print_path(A[i], B[i]);
cout << endl;
print_path(A[inv_dist[d]], B[inv_dist[d]]);
cout << endl;
break;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5640kb
input:
4 1 2 1 3 1 4 2 3 2 4
output:
3 2 1 4 2 1 3
result:
ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 5876kb
input:
5 1 2 1 3 1 4 1 5 2 3 2 5 3 4
output:
3 2 1 3 1 2 5
result:
ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
7 1 2 3 4 5 6 5 2 3 1 6 1 4 2 4 5 2 6 3 6 1 5
output:
3 2 1 6 2 5 4
result:
ok
Test #4:
score: 0
Accepted
time: 1ms
memory: 5676kb
input:
40 1 16 1 40 2 4 2 16 2 36 3 25 3 38 4 1 4 13 5 11 5 27 6 4 7 5 7 11 8 10 8 14 8 24 9 34 10 20 12 35 13 2 14 10 14 20 15 18 15 28 15 31 16 6 16 13 17 5 17 11 17 27 18 9 19 1 19 4 19 16 20 24 21 12 21 33 21 35 22 38 23 12 23 21 25 28 25 31 25 34 25 38 26 14 26 20 27 7 27 11 28 3 28 31 29 16 29 19 30 ...
output:
4 4 1 16 6 2 16 1 4
result:
ok
Test #5:
score: 0
Accepted
time: 1ms
memory: 5684kb
input:
201 1 7 1 114 1 119 2 49 2 93 4 197 5 139 6 1 6 27 7 39 7 121 8 127 9 130 9 145 11 106 11 136 11 193 12 2 12 116 13 55 13 69 13 105 13 187 13 196 14 144 14 177 15 127 15 134 15 145 15 155 15 184 15 199 16 96 16 177 17 20 21 100 22 68 22 71 22 81 22 142 23 148 23 190 24 12 24 81 24 89 25 158 25 159 2...
output:
17 13 55 126 98 38 83 78 122 44 37 28 62 101 183 76 146 196 12 2 49 22 68 142 87 89 24 81 17 54 5 139 135 194 116
result:
ok
Test #6:
score: 0
Accepted
time: 3ms
memory: 8980kb
input:
8000 2 1508 2 3068 3 5268 3 5501 6 266 6 2737 6 3197 6 5863 6 6697 7 3492 9 427 9 794 9 3114 9 5509 10 2257 10 4348 11 1479 11 1957 11 2230 11 2500 11 3182 11 4399 11 5051 11 7727 12 7669 13 1403 13 5753 14 2871 14 6956 14 7959 15 6902 17 1630 17 3155 17 5950 18 7232 19 125 19 3280 19 5648 20 6879 2...
output:
743 105 364 2092 2187 255 592 1254 5178 3600 3265 1730 438 5524 1631 3354 110 7495 6692 904 304 1723 961 5040 1390 1069 3535 1736 1410 2220 1601 888 1748 4824 2622 5856 2086 3000 1537 2878 18 7232 3251 4857 495 1604 1683 312 1430 4876 57 631 1385 1114 73 809 1398 1198 383 2782 6143 538 397 5402 859 ...
result:
ok
Test #7:
score: 0
Accepted
time: 113ms
memory: 24788kb
input:
99999 1 11261 1 21544 2 9017 2 63063 2 97990 3 11995 3 42473 4 19846 5 38099 6 35872 6 80509 7 73231 8 12356 9 35384 10 45091 12 86727 13 4938 13 48917 14 62383 14 89846 15 28458 15 44277 15 51725 15 84522 16 93258 17 13934 17 42238 18 19000 19 11278 19 23672 19 61502 19 78791 20 85057 20 88080 21 2...
output:
10318 357 30699 44409 52764 4891 25949 63478 53629 53123 7147 9245 84224 20855 11376 10232 8063 49222 47216 89740 49741 52529 9704 45743 89542 69475 37804 10692 46843 36035 3857 87381 23479 22494 7060 28263 45244 65585 11874 25539 59155 18784 25745 9101 66431 60044 8786 41650 22180 1005 58958 24751 ...
result:
ok
Test #8:
score: 0
Accepted
time: 122ms
memory: 24776kb
input:
100000 1 68531 2 97359 4 68578 4 83098 4 98443 5 8053 5 30270 5 86617 6 7074 6 12266 6 69396 7 52675 7 78316 7 90757 7 92242 8 32677 8 41353 8 41457 8 74508 9 44234 10 4973 10 38390 10 96049 11 28007 11 68620 13 3016 14 36748 15 8147 15 25110 15 28489 15 72947 15 99347 16 70760 17 12774 17 68407 17 ...
output:
3040 327 33257 60029 85210 32061 63864 21817 34812 69597 22386 4499 30945 74751 15151 2783 46548 25078 83463 3533 49298 5082 82952 46319 34631 80214 46883 5256 4171 84997 81369 37884 6932 83348 44075 25312 81512 33488 19177 57285 47435 77227 31284 78311 59536 7580 916 96352 76679 15247 11262 23592 8...
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 5660kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 7 5 1 4 7 3 1 6 7 1
output:
6 5 7 3 2 1 6 4 1 2 3 7 5
result:
ok
Test #10:
score: 0
Accepted
time: 89ms
memory: 26000kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 3 1 4 2 1 3
result:
ok
Test #11:
score: 0
Accepted
time: 1ms
memory: 5604kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 6 1 4 8 4 8 3 8 2 1 8
output:
4 3 2 1 8 3 2 1 4
result:
ok
Test #12:
score: 0
Accepted
time: 1ms
memory: 5892kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 1 3 1 4 9 5 9 4 1 7 9 2 1 9
output:
3 3 1 4 2 1 3
result:
ok
Test #13:
score: 0
Accepted
time: 0ms
memory: 5840kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 8 1 4 10 6 1 6 10 4 10 3 1 9 10 1
output:
4 5 4 1 6 3 2 1 4
result:
ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 5892kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 3 1 4 2 1 3
result:
ok
Test #15:
score: 0
Accepted
time: 4ms
memory: 9440kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
10 12 11 10 9 9999 4 3 2 1 13 5 1 2 3 4 9999 9 8 7 6
result:
ok
Test #16:
score: 0
Accepted
time: 9ms
memory: 7796kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
5 9996 9997 9998 9999 10000 6 5 4 1 7
result:
ok
Test #17:
score: 0
Accepted
time: 87ms
memory: 25000kb
input:
94753 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 3 1 4 2 1 3
result:
ok
Test #18:
score: 0
Accepted
time: 96ms
memory: 26020kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
5 99995 99996 99997 99998 99999 5 99999 2 1 6
result:
ok
Test #19:
score: 0
Accepted
time: 1ms
memory: 5576kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 1 3 1 4 1 5 1 6 1 7
output:
3 3 1 4 2 1 3
result:
ok
Test #20:
score: 0
Accepted
time: 82ms
memory: 26136kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 3 1 4 2 1 3
result:
ok
Test #21:
score: 0
Accepted
time: 0ms
memory: 5600kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 1 3 1 4 1 5 1 6 1 7 1 8
output:
3 3 1 4 2 1 3
result:
ok
Test #22:
score: 0
Accepted
time: 0ms
memory: 5660kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 1 3 1 4 1 5 1 6 1 7 1 8 1 9
output:
3 3 1 4 2 1 3
result:
ok
Test #23:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10
output:
3 3 1 4 2 1 3
result:
ok
Test #24:
score: 0
Accepted
time: 1ms
memory: 5876kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 3 1 4 2 1 3
result:
ok
Test #25:
score: 0
Accepted
time: 9ms
memory: 9752kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 3 1 4 2 1 3
result:
ok
Test #26:
score: 0
Accepted
time: 8ms
memory: 9284kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 3 1 4 2 1 3
result:
ok
Test #27:
score: 0
Accepted
time: 71ms
memory: 25624kb
input:
97065 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 3 1 4 2 1 3
result:
ok
Test #28:
score: 0
Accepted
time: 82ms
memory: 26044kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 3 1 4 2 1 3
result:
ok
Test #29:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
7 1 2 2 3 3 4 4 5 5 6 6 7 7 5 7 4 7 3 7 2 7 1
output:
3 1 2 7 3 2 7
result:
ok
Test #30:
score: 0
Accepted
time: 103ms
memory: 26184kb
input:
100000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...
output:
3 1 2 100000 3 2 100000
result:
ok
Test #31:
score: 0
Accepted
time: 0ms
memory: 5876kb
input:
8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 6 8 5 8 4 8 3 8 2 8 1
output:
3 1 2 8 3 2 8
result:
ok
Test #32:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 7 9 6 9 5 9 4 9 3 9 2 9 1
output:
3 1 2 9 3 2 9
result:
ok
Test #33:
score: 0
Accepted
time: 0ms
memory: 5648kb
input:
10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 8 10 7 10 6 10 5 10 4 10 3 10 2 10 1
output:
3 1 2 10 3 2 10
result:
ok
Test #34:
score: 0
Accepted
time: 1ms
memory: 5748kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 1 2 1000 3 2 1000
result:
ok
Test #35:
score: 0
Accepted
time: 10ms
memory: 7380kb
input:
9999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
3 1 2 9999 3 2 9999
result:
ok
Test #36:
score: 0
Accepted
time: 11ms
memory: 9620kb
input:
10000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 1 2 10000 3 2 10000
result:
ok
Test #37:
score: 0
Accepted
time: 98ms
memory: 24484kb
input:
92892 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 1 2 92892 3 2 92892
result:
ok
Test #38:
score: 0
Accepted
time: 112ms
memory: 26128kb
input:
99999 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53...
output:
3 1 2 99999 3 2 99999
result:
ok
Test #39:
score: 0
Accepted
time: 1ms
memory: 5872kb
input:
8 5 6 7 3 2 3 7 8 1 5 2 8 8 5 4 5 8 1 7 6 3 4 2 6 2 1
output:
3 5 1 8 2 1 8
result:
ok
Test #40:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
10 6 7 1 7 2 5 2 4 5 4 10 4 3 2 6 5 10 5 2 8 4 1 1 2 8 9 7 8 3 10 9 10 4 3
output:
5 4 1 7 6 5 2 1 7 6 5
result:
ok
Test #41:
score: 0
Accepted
time: 2ms
memory: 5852kb
input:
1000 272 271 393 394 369 404 981 980 169 185 362 361 387 386 482 481 383 382 370 788 266 106 938 223 876 877 107 106 109 110 481 480 633 14 886 885 588 589 673 567 568 693 531 932 562 561 871 872 89 959 951 950 119 556 484 891 981 271 75 74 443 444 865 730 374 15 580 233 716 165 882 829 622 623 606 ...
output:
416 223 222 221 512 561 562 563 564 740 741 742 743 475 476 477 714 571 311 18 17 16 266 106 107 759 908 907 906 744 882 829 830 831 832 833 332 333 334 124 125 789 788 787 786 785 784 783 782 847 846 513 197 198 422 280 281 890 420 155 154 153 152 151 557 36 35 601 716 165 166 167 168 936 935 934 1...
result:
ok
Test #42:
score: 0
Accepted
time: 7ms
memory: 7712kb
input:
9999 1503 1502 1862 3917 4579 4578 9929 8919 4989 4990 4479 7716 5512 5511 4389 4390 4430 910 5616 3889 5708 5879 8848 8849 5400 5076 7827 3718 1169 1168 1574 213 3196 4013 2414 2415 2857 2858 9177 9178 7189 7190 3550 3549 7446 5351 7766 8059 2132 2646 8813 7870 2521 2522 5158 5157 4623 4624 4957 49...
output:
1832 4776 5814 5813 5812 7713 7714 1675 797 1938 4377 8175 8176 8177 5970 5969 3282 3281 3280 3260 3261 3262 1901 8686 5763 5762 1195 5172 5171 5170 5169 5168 7602 7601 8674 8675 8676 8677 8678 547 548 549 550 551 552 2217 2218 8455 9113 9112 733 732 731 730 729 728 727 1679 1678 1677 6122 2033 3246...
result:
ok
Test #43:
score: 0
Accepted
time: 11ms
memory: 7752kb
input:
10000 5462 4989 4542 4541 7300 8478 4730 3574 7930 7051 750 7627 117 3045 4274 4275 3840 3841 5706 3638 7108 7107 28 29 2564 2563 2784 2393 1193 1192 2040 1286 3688 3687 8048 2319 2404 2405 8641 8640 6992 8729 5085 5086 5130 5131 6813 9806 6592 6769 2806 2805 7482 6021 7371 3994 4939 3217 1905 6540 ...
output:
3598 6194 3464 3465 3466 3467 3468 4609 4610 622 623 624 625 626 2769 6810 6811 6812 6813 9806 7201 7200 974 228 229 230 231 232 7038 7037 3443 3444 3445 3446 5522 5523 7308 7309 121 120 119 118 117 3045 3044 3043 5649 7938 7937 7230 9920 9921 1924 1925 1926 1927 1928 1929 3075 3076 3077 3078 3079 3...
result:
ok
Test #44:
score: 0
Accepted
time: 127ms
memory: 26268kb
input:
99999 49253 51314 3093 3092 88617 72981 43336 77222 65739 55450 5166 90677 57235 57234 51512 51511 73274 86124 86611 77777 21808 21809 2794 2795 64109 69571 80102 80101 56177 27689 55899 58255 16908 16909 53732 53733 9213 9214 33157 33158 10706 10707 76016 11308 51459 74662 58149 58150 80976 56845 2...
output:
21824 47415 47414 47413 47412 47411 63677 63676 12073 60684 45858 29046 29045 29044 28982 28981 65124 68818 56347 56348 46751 46752 81248 74224 74223 74222 87960 87961 87962 11458 8656 32236 80645 58070 47515 47514 73109 73108 73107 20328 20329 20330 9455 9454 17457 63912 63913 63914 63915 63916 790...
result:
ok
Test #45:
score: 0
Accepted
time: 115ms
memory: 25556kb
input:
96827 15894 15895 33528 48199 50450 50451 63703 63702 49937 31980 93823 45726 96052 96051 54334 16426 9193 11656 49315 10079 10614 33488 84027 84028 3612 5321 64903 64904 56901 32611 33578 68521 47938 47939 32618 53239 89613 89612 82729 82728 34512 34511 54064 38673 56419 56420 23775 75336 85989 172...
output:
7342 53166 95910 95909 88588 79441 79442 60546 60545 16171 16170 35251 35250 35249 56850 56849 94338 7283 29088 8531 8532 44363 61023 61024 25318 13173 95854 95853 95852 76449 76450 76451 2797 2796 2795 56322 71916 71915 71914 71913 71912 71911 71910 83004 83005 5299 5300 5301 2554 2553 50 49 6694 3...
result:
ok
Test #46:
score: 0
Accepted
time: 128ms
memory: 26392kb
input:
100000 72105 72104 4352 4351 59159 59160 78993 64103 39235 39234 4458 36615 23543 53027 54635 54634 80821 80822 8720 72158 49535 78364 64357 3035 93490 6597 52195 13285 70186 70187 14748 98067 15516 71738 77617 77616 68836 68835 61569 61570 28477 28289 50823 50822 71759 49859 59464 59463 83701 83702...
output:
48197 90606 90607 22121 59999 60000 60001 60002 60003 98434 98433 98432 74217 74218 33268 58691 58690 58689 46764 71076 71075 20138 36517 69326 69327 65921 29550 29551 29552 29553 29554 58883 19882 19881 19880 19879 19878 19877 19876 5803 5802 5801 5800 5799 72555 68899 3541 3542 41418 44246 45122 4...
result:
ok
Test #47:
score: 0
Accepted
time: 119ms
memory: 26212kb
input:
100000 53877 17887 7877 7878 35510 37710 15520 83926 7572 7573 11839 11840 75139 75140 63678 63679 66199 66198 3262 3263 78203 78204 87574 87575 53474 67658 86593 86594 28943 17005 71369 264 3802 41402 30583 30584 38511 38510 36776 90902 57208 57209 15408 48313 73488 46167 88419 93118 57411 57412 42...
output:
10348 6338 6337 6336 41610 42518 53544 53276 53275 83837 17864 17863 58202 43529 43528 37413 37414 37415 37416 34216 34215 78166 2245 14436 14435 38309 38310 38311 38312 79761 28088 28087 28086 35231 35230 35229 35228 28945 28944 28943 17005 17004 17003 64598 64599 63237 63236 53857 19410 19411 1941...
result:
ok
Test #48:
score: 0
Accepted
time: 118ms
memory: 26352kb
input:
100000 78895 34726 20392 44705 57147 22069 31133 31132 78946 78947 53758 53757 68970 68971 75904 87094 12439 12438 92849 92848 80817 80818 76732 53635 79930 79931 78362 78363 87661 87662 47807 47808 73696 27386 30646 30645 17648 81813 47120 47119 84905 84906 87235 8058 8238 88843 86537 12191 68784 6...
output:
23960 65812 65811 81258 70379 62438 62437 62436 62435 62434 62433 62432 46531 46530 46529 46528 46527 30694 30693 28639 28638 46289 46290 58804 58803 58802 58801 24599 83989 28703 28704 16359 55918 44536 44537 58506 19581 82083 82082 82081 82080 82079 82078 82077 99476 95950 95949 49921 49920 49919 ...
result:
ok
Test #49:
score: 0
Accepted
time: 115ms
memory: 25220kb
input:
94055 34740 73546 30256 30255 20298 20299 62592 62591 49467 49468 65041 2277 38788 38787 58735 65469 2375 2376 77665 77666 36242 80298 75550 16701 13820 64701 83448 83449 79313 83990 2213 2212 22172 22171 72441 92184 10391 30730 39194 38883 25064 90160 69140 85068 50433 31078 58353 4381 38997 38998 ...
output:
26535 54471 54472 54473 84676 84675 74216 74217 52020 69155 40661 40662 40663 61183 61182 61181 61180 61179 65886 82101 82100 37932 37933 37934 37935 37936 37937 31813 70039 70040 70041 70042 23885 52507 52508 52797 9348 9347 9346 9538 90896 40002 40001 63671 63672 63673 63674 63675 63676 63677 6367...
result:
ok
Test #50:
score: 0
Accepted
time: 0ms
memory: 5576kb
input:
7 6 2 4 3 3 7 7 6 1 2 7 2 1 5 6 5 4 5 5 7 2 3
output:
4 5 6 2 7 1 2 6 5
result:
ok
Test #51:
score: 0
Accepted
time: 110ms
memory: 26104kb
input:
99084 7128 52592 26282 84361 19470 70586 2431 2430 33596 72767 70001 70000 65483 65484 76493 76492 62792 39465 4476 31233 72512 72511 94244 69778 84662 84663 32214 32213 4717 4718 73918 26226 71389 71390 45765 45764 87589 87590 6207 6206 47094 70119 30908 29826 34602 40286 44413 44412 21890 21889 24...
output:
9981 7858 35864 35863 35862 35861 18074 18073 18072 55633 64969 64970 64971 64972 64973 64974 84299 84298 82979 97520 35779 35780 96076 11239 11240 11241 11242 11243 11244 11245 11246 47956 47957 88166 40893 40892 40891 40890 82456 82455 47524 47525 87069 87070 87071 49653 49654 20055 86209 98415 12...
result:
ok
Test #52:
score: 0
Accepted
time: 0ms
memory: 5836kb
input:
8 6 5 3 4 2 3 3 7 2 4 6 7 4 8 5 2 2 1 1 6 7 8 5 4 8 1
output:
5 4 3 2 1 8 6 1 2 3 7
result:
ok
Test #53:
score: 0
Accepted
time: 1ms
memory: 5668kb
input:
9 6 7 7 3 9 8 4 3 2 1 6 2 6 8 5 6 7 8 1 4 9 4 4 5 9 6 1 9 2 3
output:
6 3 7 6 2 1 4 8 7 6 2 1 9
result:
ok
Test #54:
score: 0
Accepted
time: 0ms
memory: 5904kb
input:
9 5 4 1 5 3 2 1 2 2 9 6 7 1 8 3 4 7 5 5 6 5 9 6 3 9 1 7 8 8 9
output:
5 5 4 3 6 7 2 1 5 4 3
result:
ok
Test #55:
score: 0
Accepted
time: 1ms
memory: 7716kb
input:
10 1 8 10 9 4 9 6 4 2 1 2 3 7 2 4 5 10 3 5 8 2 9 6 5 8 9 4 8 6 7 7 8 3 4
output:
3 4 5 8 5 4 6
result:
ok
Test #56:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
9 5 6 8 7 1 2 5 2 8 6 6 9 9 8 2 9 4 7 4 1 4 5 6 1 2 3 3 4 7 6
output:
4 6 1 2 9 5 2 1 6
result:
ok
Test #57:
score: 0
Accepted
time: 1ms
memory: 5892kb
input:
10 1 2 3 2 6 8 5 4 5 6 8 7 4 1 6 7 4 3 2 5 3 10 8 9 6 2 10 1 9 3 8 4 9 10
output:
4 3 2 1 10 3 2 1 4
result:
ok
Test #58:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
9 3 6 2 1 5 6 9 7 4 2 4 3 1 3 8 9 1 5 6 7 4 6 1 9 7 8 4 5 2 3
output:
5 5 1 2 4 6 3 1 2 4 6
result:
ok
Test #59:
score: 0
Accepted
time: 1ms
memory: 5836kb
input:
4 1 2 4 1 4 3 3 1 4 2
output:
3 2 1 4 3 1 4
result:
ok
Test #60:
score: 0
Accepted
time: 1ms
memory: 5808kb
input:
10 8 10 10 9 7 8 8 3 6 3 1 3 9 6 1 8 5 10 3 4 10 4 3 9 2 1 1 9 6 5 6 10 9 5
output:
3 3 6 9 3 1 8
result:
ok
Test #61:
score: 0
Accepted
time: 2ms
memory: 5856kb
input:
1000 937 387 833 217 405 422 502 356 529 374 497 662 803 845 726 979 999 43 463 620 749 828 661 573 191 708 513 963 737 819 439 571 787 166 873 842 993 566 590 908 34 184 699 314 756 255 996 242 653 402 451 656 90 762 562 382 945 397 600 816 789 890 378 965 613 827 319 645 156 684 477 570 131 419 43...
output:
95 378 965 450 534 219 777 631 844 48 41 27 37 244 110 535 318 70 866 600 816 459 985 76 380 478 788 227 67 108 658 273 929 533 436 548 310 821 972 79 155 138 689 960 532 680 226 657 860 676 379 299 621 497 662 367 796 412 904 583 19 269 774 44 403 604 438 441 941 30 838 249 964 520 761 277 723 50 4...
result:
ok
Test #62:
score: 0
Accepted
time: 12ms
memory: 7660kb
input:
9999 2524 8191 1533 7530 356 1008 8210 3560 2071 540 2876 4324 9158 3771 2872 5625 4701 4769 4728 2104 2264 9841 4009 2392 9900 4852 9836 1027 3996 1557 97 1319 5587 7722 7488 4073 2940 9762 246 6394 380 6935 7929 3557 8049 8841 2105 7255 2710 6626 7926 6255 8392 6949 6174 2040 9959 8955 8701 3730 5...
output:
3874 2220 9588 1060 528 8260 1924 2131 8608 5233 2517 3502 8689 1325 3681 4914 3222 7482 5768 7397 2807 2639 6048 5246 9848 234 3154 3039 6159 4660 6640 8973 7803 1685 756 4671 3149 4264 9667 5397 3005 8439 3647 889 5107 7424 2225 4238 4211 5021 9924 9946 1425 9668 4931 3330 9921 6212 6334 9082 603 ...
result:
ok
Test #63:
score: 0
Accepted
time: 11ms
memory: 5876kb
input:
10000 8697 615 9680 5350 5924 4698 4478 7356 3510 7535 6046 3305 885 4890 8224 2297 2267 8411 7331 7035 1747 7766 3540 1409 4143 212 9541 5746 1062 539 2060 9566 5293 350 6143 2220 1446 2866 4603 4151 9625 5078 3432 4169 1528 1525 9522 2738 3154 3100 8560 9024 1200 4420 3138 9200 2346 182 1694 6303 ...
output:
4217 5523 8296 3588 2257 7539 9798 8613 851 5805 1708 165 8500 1695 7506 2005 2810 8734 4596 4172 4645 8343 5833 3915 1819 3569 6013 9221 1187 2225 8027 2174 9746 4890 1758 649 3994 4922 5179 4409 8420 3811 5409 8535 2401 8439 2914 3991 2388 9352 505 3429 5394 3068 34 5776 7111 4609 2633 8465 2491 5...
result:
ok
Test #64:
score: -100
Wrong Answer
time: 123ms
memory: 25780kb
input:
99999 84520 53880 95569 33800 30674 78149 34453 98159 29766 87018 38710 45543 78103 64279 95388 6083 90709 6245 28076 59536 89121 25989 17455 86681 24869 49677 88947 54071 59069 14675 2211 80543 84618 24731 71749 96646 3072 81888 41124 19659 78748 83891 86353 92485 51719 3101 86489 39980 2846 67916 ...
output:
1 24550 -1 99913 26734 -1 62745
result:
wrong answer Integer 1 violates the range [3, 99999]