QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#113836 | #5545. Contingency Plan | PetroTarnavskyi# | AC ✓ | 40ms | 14892kb | C++17 | 1.5kb | 2023-06-19 17:21:43 | 2023-06-19 17:21:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int N = 100447;
vector<PII> g[N];
int deg[N];
PII ans[N];
int root = 0;
int u = -1;
int n;
void dfs(int v, int idx, int h = 0)
{
if (h == 0)
{
sort(ALL(g[v]), [&](PII a, PII b)
{
return deg[a.first] > deg[b.first];
});
}
if (h >= 2)
{
if (u == -1) u = v;
ans[idx] = {root, v};
}
int pr = -1, pi = -1;
int mx = 0;
for (auto& [to, i] :g[v])
{
mx = max(mx, i);
if (i != idx)
{
dfs(to, i, h + 1);
if (h == 0 && pr != -1)
{
ans[pi] = {pr, to};
}
pi = i;
pr = to;
}
}
if (h == 0)
{
ans[pi] = {pr, u};
FOR (i, mx + 1, n)
{
if (ans[i] == MP(root, u))
{
swap(ans[i], ans[mx]);
break;
}
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
FOR (i, 0, n - 1)
{
int a, b;
cin >> a >> b;
a--, b--;
g[a].PB({b, i});
g[b].PB({a, i});
deg[a]++, deg[b]++;
}
if (*max_element(deg, deg + n) == n - 1)
{
cout << -1 << '\n';
return 0;
}
while (deg[root] == 1) root++;
dfs(root, -1, 0);
FOR (i, 0, n - 1)
{
cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 5800kb
input:
7 1 2 3 7 2 4 2 5 1 3 3 6
output:
2 3 1 7 1 4 1 5 3 4 1 6
result:
ok AC
Test #2:
score: 0
Accepted
time: 2ms
memory: 6276kb
input:
3 1 2 2 3
output:
-1
result:
ok AC
Test #3:
score: 0
Accepted
time: 2ms
memory: 5976kb
input:
2 2 1
output:
-1
result:
ok AC
Test #4:
score: 0
Accepted
time: 2ms
memory: 6180kb
input:
5 2 1 2 3 2 4 4 5
output:
1 3 3 5 2 5 4 1
result:
ok AC
Test #5:
score: 0
Accepted
time: 2ms
memory: 6096kb
input:
5 1 4 3 4 4 5 2 5
output:
1 3 3 2 4 2 5 1
result:
ok AC
Test #6:
score: 0
Accepted
time: 2ms
memory: 6064kb
input:
5 5 2 1 2 4 2 3 4
output:
5 1 1 3 2 3 4 5
result:
ok AC
Test #7:
score: 0
Accepted
time: 3ms
memory: 7352kb
input:
20000 1 2 1 3 4 1 5 1 6 1 7 1 1 8 1 9 1 10 1 11 12 1 1 13 14 1 1 15 1 16 17 1 1 18 1 19 20 1 21 1 22 1 1 23 24 1 1 25 26 1 1 27 28 1 29 1 30 1 1 31 1 32 1 33 1 34 1 35 36 1 1 37 1 38 1 39 40 1 41 1 1 42 1 43 44 1 1 45 46 1 1 47 48 1 49 1 1 50 1 51 52 1 53 1 54 1 1 55 56 1 57 1 58 1 1 59 60 1 61 1 1 ...
output:
2 6670 3 31 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 21 13 22 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 11 23 129 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 40 32 80 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 69 42 70 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 60 52 61 53 52 ...
result:
ok AC
Test #8:
score: 0
Accepted
time: 7ms
memory: 7188kb
input:
20000 7662 1 9205 1 5971 1 1 9886 1 18853 14108 1 998 1 1 14958 7100 1 1 2670 1 18493 13838 1 4644 1 2139 1 1 18540 1 14081 1 16836 1 9357 245 1 242 1 1 13472 1 1471 3792 1 1 17875 13976 1 1 15085 1 17283 15014 1 17477 1 11578 1 18441 1 1 14367 3018 1 1 7186 1 4939 2470 1 2993 1 6175 1 1 19886 1 125...
output:
7662 3346 9205 11578 5971 9205 9886 5971 18853 9886 14108 18853 998 14108 14958 998 7100 14958 2670 7100 18493 242 13838 13472 4644 13838 2139 4644 18540 2139 14081 18540 16836 14081 9357 16836 245 9357 242 245 13472 2670 1471 1107 3792 1471 17875 3792 13976 17875 15085 13976 17283 15085 15014 17283...
result:
ok AC
Test #9:
score: 0
Accepted
time: 7ms
memory: 6808kb
input:
20000 8854 1 15635 1 8088 1 1 12138 12367 1 1 15051 6392 1 15564 1 17334 1 1 10164 8704 1 1 13795 1 10292 12108 1 1 50 4 1 1 18364 13341 1 19203 1 1 3017 1 5133 3499 1 19202 1 1 10304 12975 1 1 17220 1 1716 1 4158 1 16763 1 301 1 16645 8690 1 1 10064 16977 1 1 19618 1 5471 1 8763 3997 1 1 3283 11332...
output:
8854 10691 15635 301 8088 15635 12138 8088 12367 12138 15051 12367 6392 15051 15564 6392 17334 15564 10164 17334 8704 3017 13795 5133 10292 13795 12108 10292 50 12108 4 50 18364 4 13341 18364 19203 13341 3017 19203 5133 10164 3499 14807 19202 3499 10304 19202 12975 10304 17220 12975 1716 17220 4158 ...
result:
ok AC
Test #10:
score: 0
Accepted
time: 3ms
memory: 6672kb
input:
20000 1 2 2 3 4 2 2 5 2 6 2 7 2 8 9 2 10 2 2 11 12 2 2 13 14 2 2 15 2 16 17 2 2 18 19 2 20 2 2 21 22 2 2 23 24 2 2 25 26 2 2 27 2 28 29 2 30 2 2 31 2 32 2 33 2 34 35 2 36 2 37 2 38 2 2 39 40 2 2 41 42 2 43 2 2 44 45 2 46 2 2 47 2 48 2 49 50 2 51 2 2 52 2 53 54 2 55 2 56 2 57 2 2 58 2 59 60 2 61 2 2 ...
output:
1 6670 3 31 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 21 13 22 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 11 23 129 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 40 32 80 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 69 42 70 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 60 52 61 53 52 ...
result:
ok AC
Test #11:
score: 0
Accepted
time: 1ms
memory: 6684kb
input:
20000 1 13291 13291 19998 3314 13291 13291 3339 13291 10237 13244 13291 13291 3392 13291 4459 13291 17335 13291 10356 6124 13291 13291 4470 12896 13291 13291 12094 3309 13291 13319 13291 13291 15658 13291 2305 13291 13710 13291 16520 13291 16234 6697 13291 13291 6686 9187 13291 13291 43 13291 2764 1...
output:
1064 1 1064 19998 1064 3314 1064 3339 1064 10237 1064 13244 1064 3392 1064 4459 1064 17335 1064 10356 1064 6124 1064 4470 1064 12896 1064 12094 1064 3309 1064 13319 1064 15658 1064 2305 1064 13710 1064 16520 1064 16234 1064 6697 1064 6686 1064 9187 1064 43 1064 2764 1064 9061 1064 8113 1064 8449 106...
result:
ok AC
Test #12:
score: 0
Accepted
time: 8ms
memory: 6904kb
input:
20000 4030 5565 1206 5565 5565 8947 4887 5565 14605 5565 5565 2947 5565 9038 5565 5326 5565 9021 11087 5565 5565 19562 895 5565 14653 5565 5565 10803 5565 9750 5565 16331 4689 5565 14307 5565 11631 5565 5565 13244 10554 5565 8112 5565 5565 9394 5565 5945 15279 5565 5565 15512 1334 5565 5565 6025 556...
output:
4030 2271 1206 3491 8947 1206 4887 8947 14605 4887 2947 14605 9038 2947 5326 9038 9021 5326 11087 9021 19562 13244 895 10554 14653 895 10803 14653 9750 10803 16331 9750 4689 16331 14307 4689 11631 14307 13244 11631 10554 11087 8112 1776 9394 8112 5945 9394 15279 5945 15512 15279 1334 15512 6025 1334...
result:
ok AC
Test #13:
score: 0
Accepted
time: 23ms
memory: 10492kb
input:
100000 1 2 3 1 1 4 5 1 1 6 1 7 1 8 1 9 10 1 1 11 1 12 13 1 1 14 1 15 16 1 17 1 18 1 1 19 1 20 1 21 1 22 1 23 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 1 32 33 1 34 1 35 1 36 1 37 1 1 38 1 39 1 40 1 41 1 42 43 1 1 44 45 1 1 46 1 47 48 1 49 1 1 50 51 1 52 1 53 1 54 1 1 55 56 1 57 1 58 1 59 1 60 1 1 61 1...
output:
2 33338 3 39 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 26 15 27 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 13 28 160 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 50 40 100 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 87 52 88 53 5...
result:
ok AC
Test #14:
score: 0
Accepted
time: 2ms
memory: 5804kb
input:
5 2 1 3 2 4 3 5 4
output:
1 4 2 4 3 1 2 5
result:
ok AC
Test #15:
score: 0
Accepted
time: 12ms
memory: 10568kb
input:
100000 21871 1 13678 1 27196 1 70437 1 1 35891 1 43010 28018 1 1 64489 61157 1 1 35572 1 41613 1 73049 93865 1 83507 1 1 92127 86278 1 1 15004 1 44154 2005 1 1 94210 41410 1 1 5886 69836 1 1 24120 1 80802 1 9940 66220 1 66549 1 1 20103 1 5 1 33021 35482 1 76185 1 34850 1 1 55173 1 72488 1 76286 1 99...
output:
21871 29202 13678 99583 27196 13678 70437 27196 35891 70437 43010 35891 28018 43010 64489 28018 61157 64489 35572 61157 41613 35572 73049 41613 93865 80802 83507 9940 92127 83507 86278 92127 15004 86278 44154 15004 2005 44154 94210 2005 41410 94210 5886 41410 69836 5886 24120 69836 80802 24120 9940 ...
result:
ok AC
Test #16:
score: 0
Accepted
time: 24ms
memory: 10548kb
input:
100000 1 12976 28108 1 87682 1 79359 1 16128 1 1 90652 1 55874 27276 1 1 66899 1 10296 1 37870 1 78978 26221 1 28589 1 1 46430 32252 1 22407 1 68230 1 64944 1 1 53457 31023 1 1 57101 1 82578 1 33273 69683 1 64357 1 1 32517 1 45623 1 29497 41082 1 1 43731 1 28620 1 64304 1 23462 1 81982 1 91877 1 309...
output:
12976 68390 28108 86781 87682 28108 79359 87682 16128 79359 90652 16128 55874 90652 27276 55874 66899 27276 10296 66899 37870 10296 78978 37870 26221 69683 28589 64357 46430 28589 32252 46430 22407 32252 68230 22407 64944 68230 53457 64944 31023 53457 57101 31023 82578 57101 33273 82578 69683 33273 ...
result:
ok AC
Test #17:
score: 0
Accepted
time: 26ms
memory: 10748kb
input:
100000 1 2 2 3 4 2 5 2 2 6 7 2 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 16 2 2 17 18 2 19 2 20 2 21 2 2 22 23 2 24 2 2 25 2 26 27 2 28 2 29 2 30 2 2 31 32 2 2 33 34 2 35 2 2 36 2 37 38 2 2 39 40 2 2 41 42 2 43 2 44 2 45 2 2 46 47 2 2 48 49 2 50 2 2 51 2 52 2 53 2 54 2 55 56 2 2 57 58 2 59 2 60 2 61 2 6...
output:
1 33338 3 39 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 26 15 27 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 13 28 160 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 50 40 100 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 87 52 88 53 5...
result:
ok AC
Test #18:
score: 0
Accepted
time: 30ms
memory: 10380kb
input:
100000 15924 1 13919 15924 86413 15924 15924 78418 36904 15924 15924 60478 15924 78563 15924 23855 63531 15924 15574 15924 73713 15924 62532 15924 15924 19461 15924 80750 15924 57012 15924 27046 55780 15924 69619 15924 58970 15924 65824 15924 15924 3195 26782 15924 71411 15924 84915 15924 95347 1592...
output:
1 19978 13919 4974 86413 13919 78418 86413 36904 78418 60478 36904 78563 60478 23855 78563 63531 23855 15574 63531 73713 15574 62532 73713 19461 95347 80750 53739 57012 80750 27046 57012 55780 27046 69619 55780 58970 69619 65824 58970 3195 65824 26782 3195 71411 26782 84915 71411 95347 84915 53739 6...
result:
ok AC
Test #19:
score: 0
Accepted
time: 40ms
memory: 10584kb
input:
100000 40659 47250 51514 40659 40659 83613 16333 40659 25291 40659 40659 61711 40659 37621 40659 66805 40659 59550 67744 40659 40659 46644 40659 21771 40659 98164 40659 6655 75053 40659 90431 40659 40659 58023 48769 40659 11506 40659 19125 40659 52852 40659 98702 40659 53360 40659 40659 3999 66767 4...
output:
15917 47250 15917 51514 15917 83613 15917 16333 15917 25291 15917 61711 15917 37621 15917 66805 15917 59550 15917 67744 15917 46644 15917 21771 15917 98164 15917 6655 15917 75053 15917 90431 15917 58023 15917 48769 15917 11506 15917 19125 15917 52852 15917 98702 15917 53360 15917 3999 15917 66767 15...
result:
ok AC
Test #20:
score: 0
Accepted
time: 4ms
memory: 6824kb
input:
20000 13211 1 1 10767 13211 16998 13211 495 10767 7635 10767 6994 10669 16998 1369 16998 495 4745 722 495 7635 251 3552 7635 7267 6994 6994 1772 10669 18929 10669 9328 3076 1369 1369 14212 4745 284 4745 9599 722 6137 722 10565 15137 251 5349 251 16431 3552 3552 15719 7267 10917 598 7267 19533 1772 1...
output:
13211 10767 1 16998 10767 16998 1 495 1 7635 1 6994 1 10669 1 1369 1 4745 1 722 1 251 1 3552 1 7267 1 1772 1 18929 1 9328 1 3076 1 14212 1 284 1 9599 1 6137 1 10565 1 15137 1 5349 1 16431 1 15719 1 10917 1 598 1 19533 1 5233 1 13724 1 10707 1 7333 1 13598 1 9683 1 6305 1 16056 1 12864 1 16760 1 1895...
result:
ok AC
Test #21:
score: 0
Accepted
time: 3ms
memory: 6924kb
input:
20000 11262 14400 16805 2790 19084 11979 15259 5949 9916 12236 2445 1637 1905 15141 9540 16655 12812 16186 19052 1523 6643 1443 13738 10091 9218 1337 16617 16436 17295 16466 1171 1217 19150 5280 2830 8076 16135 7234 11460 213 8101 341 5438 6331 5029 14871 10725 2090 5998 12241 8902 3420 4340 7265 18...
output:
1 14400 1 16805 1 11979 1 5949 1 9916 1 2445 1 15141 1 16655 1 16186 1 1523 1 1443 1 10091 1 9218 1 16617 1 16466 1 1217 1 19150 1 2830 1 7234 1 11460 1 8101 1 6331 1 14871 1 10725 1 12241 1 8902 1 7265 1 5618 1 14867 1 741 1 19617 1 10801 1 12234 1 1508 1 18805 1 18298 1 8321 1 11096 1 12347 1 1363...
result:
ok AC
Test #22:
score: 0
Accepted
time: 4ms
memory: 6824kb
input:
20000 19272 1 19272 7240 6952 7240 6952 10594 12564 10594 12564 13132 14483 13132 14483 1891 9772 1891 16614 9772 14519 16614 12050 14519 4039 12050 4039 9679 8408 4039 12050 6797 17990 6797 6797 17659 14519 14985 16415 14985 1735 16415 16415 18821 14985 9402 9402 18947 9402 5386 17560 16614 17560 1...
output:
19272 327 1 7240 1 6952 1 10594 1 12564 1 13132 1 14483 1 1891 1 9772 1 16614 1 14519 1 12050 1 4039 1 9679 1 8408 1 6797 1 17990 1 17659 1 14985 1 16415 1 1735 1 18821 1 9402 1 18947 1 5386 1 17560 1 1094 1 7537 1 19700 1 9876 1 16466 1 11779 1 8212 1 793 1 12138 1 1491 1 3819 1 12635 1 8903 1 5872...
result:
ok AC
Test #23:
score: 0
Accepted
time: 8ms
memory: 6940kb
input:
20000 4410 1 7210 1 1 2389 4410 18377 4410 4507 7905 4410 7210 14849 12441 7210 7210 9005 17807 2389 2389 6619 2389 6604 6913 18377 5811 18377 7249 18377 4507 1582 4507 8857 4507 17635 10077 7905 7905 4687 8607 7905 14849 16870 14849 3298 14849 2376 12441 9009 12441 10729 19879 12441 9005 19790 7715...
output:
4410 7210 7210 2389 1 18377 2389 18377 1 4507 1 7905 1 14849 1 12441 1 9005 1 17807 1 6619 1 6604 1 6913 1 5811 1 7249 1 1582 1 8857 1 17635 1 10077 1 4687 1 8607 1 16870 1 3298 1 2376 1 9009 1 10729 1 19879 1 19790 1 7715 1 4016 1 18955 1 11427 1 8360 1 2365 1 19675 1 7633 1 7521 1 5414 1 16483 1 1...
result:
ok AC
Test #24:
score: 0
Accepted
time: 8ms
memory: 6780kb
input:
20000 7223 19213 12395 18674 16451 12980 18029 7848 16056 11920 6906 11077 3923 10662 9192 4837 17604 11135 16462 2457 18842 9770 15130 10251 19601 6770 7954 12079 7559 642 15051 17509 1146 18583 18196 17621 4980 8041 19973 15310 16834 11112 3176 8010 957 12737 4072 830 3194 1873 11400 3394 6914 806...
output:
1 19213 1 12395 1 12980 1 7848 1 11920 1 6906 1 3923 1 4837 1 11135 1 2457 1 9770 1 10251 1 6770 1 12079 1 7559 1 15051 1 1146 1 17621 1 8041 1 19973 1 11112 1 3176 1 957 1 830 1 3194 1 11400 1 6914 1 14516 1 15976 1 1868 1 19612 1 163 1 13285 1 3523 1 5435 1 11408 1 5989 1 17775 1 17594 1 15194 1 1...
result:
ok AC
Test #25:
score: 0
Accepted
time: 1ms
memory: 6980kb
input:
5 2 1 3 1 4 1 1 5
output:
-1
result:
ok AC
Test #26:
score: 0
Accepted
time: 7ms
memory: 7704kb
input:
20000 1 4794 4794 19823 8249 19823 8249 19672 16549 19672 13478 16549 3608 13478 3608 14623 14623 10303 19353 14623 14623 7999 3608 14367 14367 17910 14367 8488 16947 14367 3608 1121 1121 1836 13048 1121 17393 1121 11488 13478 11488 17346 8954 17346 17346 4922 17346 13440 11488 2278 16202 2278 593 2...
output:
4794 16167 1 19823 1 8249 1 19672 1 16549 1 13478 1 3608 1 14623 1 10303 1 19353 1 7999 1 14367 1 17910 1 8488 1 16947 1 1121 1 1836 1 13048 1 17393 1 11488 1 17346 1 8954 1 4922 1 13440 1 2278 1 16202 1 593 1 13598 1 12496 1 7488 1 8346 1 2126 1 4302 1 5211 1 4461 1 13940 1 11704 1 3287 1 2229 1 28...
result:
ok AC
Test #27:
score: 0
Accepted
time: 8ms
memory: 6956kb
input:
20000 1 17253 5390 1 1 10221 1 16259 8902 1 10509 1 1 16551 1 13314 1 12754 1 11707 1 7781 1 2105 1 18132 1 12907 1 5609 1 15234 1 18609 1 13919 1 13882 1 15621 1 1997 1 14002 1 18056 7498 1 13534 1 1530 1 1 14773 1 2001 1 10679 1 13745 6140 1 19975 1 14198 1 1 7536 5623 1 1 6120 1 6954 730 1 1 1601...
output:
17253 18308 5390 10221 10221 16259 16259 8902 8902 10509 10509 16551 16551 13314 13314 12754 12754 6120 11707 5390 7781 2105 2105 18132 18132 12907 12907 5609 5609 15234 15234 18609 18609 12046 13919 2001 13882 15621 15621 1997 1997 14002 14002 18056 18056 7498 7498 13534 13534 1530 1530 13919 14773...
result:
ok AC
Test #28:
score: 0
Accepted
time: 4ms
memory: 6780kb
input:
20000 5445 4016 925 12966 8179 19342 5779 1 9123 4530 5079 8720 8754 5478 17667 13748 7203 13819 10489 7645 8537 14929 4717 5427 239 4564 17407 14318 6756 7348 4638 17915 19455 15109 3853 19342 15246 17470 8228 16612 7726 13819 1 16617 16607 6208 6228 12081 1615 14545 11897 16624 7653 14499 7273 195...
output:
1 5445 1 12966 1 8179 5779 816 1 9123 1 5079 1 5478 1 13748 1 7203 1 7645 1 14929 1 4717 1 4564 1 14318 1 7348 1 17915 1 15109 1 3853 1 15246 1 8228 1 7726 16617 16624 1 16607 1 6228 1 1615 1 11897 1 14499 1 19530 1 15437 1 17582 1 9523 1 18894 1 7204 1 1183 1 6264 1 12776 1 10060 1 4195 1 15487 1 6...
result:
ok AC
Test #29:
score: 0
Accepted
time: 5ms
memory: 7396kb
input:
20000 1 10558 10558 7298 7298 3082 17807 7298 793 7298 11663 7298 12412 7298 10699 7298 7298 1146 2462 7298 7298 12577 11701 7298 7298 7622 3831 7298 19955 7298 3001 7298 7298 18329 7298 851 7298 16782 7298 17396 7298 15015 12771 7298 7298 10926 4736 7298 9088 7298 4867 7298 16066 7298 7298 2148 729...
output:
10558 16592 1 7298 1 3082 1 17807 1 793 1 11663 1 12412 1 10699 1 1146 1 2462 1 12577 1 11701 1 7622 1 3831 1 19955 1 3001 1 18329 1 851 1 16782 1 17396 1 15015 1 12771 1 10926 1 4736 1 9088 1 4867 1 16066 1 2148 1 9282 1 3101 1 1177 1 16186 1 18525 1 9265 1 10881 1 15895 1 14732 1 15331 1 10411 1 1...
result:
ok AC
Test #30:
score: 0
Accepted
time: 8ms
memory: 7844kb
input:
20000 1 11767 10226 11767 6246 10226 6576 6246 458 6576 458 5997 16052 5997 16052 10900 4370 10900 4370 17480 17480 11379 4859 11379 14663 4859 18363 14663 1454 18363 18490 1454 18490 17760 17760 19850 19832 19850 4252 19832 5482 4252 2802 5482 17779 2802 17779 8601 10844 8601 10844 17372 1230 17372...
output:
2 1 2 11767 2 10226 2 6246 2 6576 2 458 2 5997 2 16052 2 10900 2 4370 2 17480 2 11379 2 4859 2 14663 2 18363 2 1454 2 18490 2 17760 2 19850 2 19832 2 4252 2 5482 2 2802 2 17779 2 8601 2 10844 2 17372 2 1230 2 13019 2 3128 2 19136 2 9687 2 9016 2 12862 2 18082 2 14262 2 11849 2 3064 2 15552 2 3949 2 ...
result:
ok AC
Test #31:
score: 0
Accepted
time: 5ms
memory: 7792kb
input:
20000 16653 18166 1123 17313 12716 14313 11207 7401 2794 831 480 7420 4462 1161 575 456 15192 3052 12389 7101 15729 18976 18772 19492 18805 2052 866 10412 8160 3697 13319 15062 19241 11526 11876 3502 613 17770 15035 14829 6518 16531 11665 19122 15722 18062 19841 14843 5758 3123 1633 14519 3637 13277...
output:
2 18166 2 17313 2 12716 2 11207 2 831 2 7420 2 1161 2 575 2 3052 2 7101 2 18976 2 18772 2 18805 2 866 2 8160 2 15062 2 19241 2 11876 2 613 2 14829 2 16531 2 11665 2 15722 2 14843 2 5758 2 14519 2 13277 2 14004 2 11487 2 383 2 18796 2 8073 2 14763 2 2091 2 12285 2 4132 2 19583 2 3795 2 12657 2 1595 2...
result:
ok AC
Test #32:
score: 0
Accepted
time: 2ms
memory: 7540kb
input:
20000 5613 1 1 999 1 16709 1 2491 9549 1 19706 1 1 1022 1 3884 1 1916 6627 1 1 1600 10265 1 1 19100 19766 1 1 7450 1 14375 5986 1 10295 1 8625 1 11810 1 1 15542 1 5745 3506 1 12842 1 1 11860 1 16317 1 6553 12476 1 1 6031 8445 1 6462 1 1 1601 1 3014 14100 1 1 6771 1 2360 1 15402 4549 1 6116 1 1 17848...
output:
-1
result:
ok AC
Test #33:
score: 0
Accepted
time: 1ms
memory: 6684kb
input:
20000 2509 13795 17043 13795 12006 13795 13795 822 3022 13795 8572 13795 2579 13795 13795 9673 12654 13795 4181 13795 13795 15912 13795 8902 13795 19201 5015 13795 243 13795 13795 6524 13795 9461 16403 13795 13795 18444 1316 13795 15366 13795 13795 17126 13795 309 13795 10938 13795 1255 13795 5588 1...
output:
-1
result:
ok AC
Test #34:
score: 0
Accepted
time: 8ms
memory: 6720kb
input:
20000 12144 2902 8713 11740 8870 10266 6116 3885 5943 8380 10496 956 14162 9193 4497 3275 5480 4601 6858 17285 1067 3003 19501 1958 5579 12167 844 12167 5372 16648 18876 13545 6559 10656 2910 6918 5632 16656 10135 11948 11253 13524 10068 15948 17884 3833 6830 16257 1248 6924 9806 14359 11033 8077 86...
output:
1 12144 1 8713 1 10266 1 6116 1 5943 1 10496 1 9193 1 4497 1 5480 1 6858 1 3003 1 1958 1 5579 1 12167 1 16648 1 18876 1 10656 1 6918 1 5632 1 10135 1 11253 1 10068 1 3833 1 16257 1 6924 1 9806 1 8077 1 8650 1 9461 1 2145 1 18808 1 17834 1 17118 1 5268 1 17239 1 12697 1 18861 1 6613 1 14103 1 3550 1 ...
result:
ok AC
Test #35:
score: 0
Accepted
time: 6ms
memory: 6912kb
input:
20000 1284 10854 1436 9770 17852 14859 19561 13068 19123 19730 8297 15453 7167 3888 5853 15710 18440 5611 9368 5242 6667 12315 19899 12021 13550 19105 16314 1977 18051 11095 4122 16348 1987 4873 14613 10548 375 11649 6442 1199 228 18390 4006 7870 2115 10763 13056 1980 4042 9649 11446 10078 14111 289...
output:
2 1284 2 1436 2 17852 2 13068 2 19730 2 15453 2 3888 2 5853 2 18440 2 5242 2 12315 2 12021 2 19105 2 1977 2 11095 2 4122 2 4873 2 10548 2 11649 2 1199 2 228 2 4006 2 10763 2 1980 2 9649 2 11446 2 14111 2 14896 2 6991 2 6627 2 4581 2 10616 2 18363 2 430 2 4544 2 2417 2 19156 2 10018 2 11010 2 9777 2 ...
result:
ok AC
Test #36:
score: 0
Accepted
time: 2ms
memory: 5972kb
input:
7 2 1 1 7 6 2 2 4 7 3 7 5
output:
2 7 1 6 7 6 1 4 1 3 1 5
result:
ok AC
Test #37:
score: 0
Accepted
time: 8ms
memory: 7084kb
input:
20000 1 1914 16448 1914 16448 447 1 19785 19232 19785 17236 19785 12409 17236 11707 12409 15526 11707 15526 12645 19367 12645 19367 7871 12617 7871 658 7871 2936 7871 10186 2936 10186 12483 4222 12483 4222 6106 3280 6106 7313 6106 17305 6106 2244 17305 17305 18735 16748 6106 16748 1554 16748 1261 73...
output:
1914 19232 1 16448 1 447 1 19232 19785 1914 1 17236 1 12409 1 11707 1 15526 1 12645 1 19367 1 7871 1 12617 1 658 1 2936 1 10186 1 12483 1 4222 1 6106 1 3280 1 7313 1 17305 1 2244 1 18735 1 16748 1 1554 1 1261 1 7318 1 9524 1 7917 1 6734 1 18980 1 13963 1 17414 1 18244 1 12882 1 13768 1 221 1 17327 1...
result:
ok AC
Test #38:
score: 0
Accepted
time: 8ms
memory: 7516kb
input:
20000 8234 1 16079 8234 18825 16079 18825 12361 12361 6709 6709 10905 12205 10905 3916 12205 16311 3916 16423 16311 16423 10094 10094 9710 1474 9710 1474 18631 18631 13459 6640 13459 19380 6640 19380 6320 19874 6320 2212 19874 2212 8880 8880 2809 15348 2809 14869 15348 14869 8029 924 8029 924 10270 ...
output:
3 1 3 8234 3 16079 3 18825 3 12361 3 6709 3 10905 3 12205 3 3916 3 16311 3 16423 3 10094 3 9710 3 1474 3 18631 3 13459 3 6640 3 19380 3 6320 3 19874 3 2212 3 8880 3 2809 3 15348 3 14869 3 8029 3 924 3 10270 3 16526 3 4694 3 1818 3 15046 3 10755 3 124 3 8951 3 3035 3 3827 3 4302 3 16023 3 7306 3 1817...
result:
ok AC
Test #39:
score: 0
Accepted
time: 4ms
memory: 7672kb
input:
20000 3828 10203 17892 5873 17224 10321 12241 7554 2948 6507 17619 16861 11410 1012 17019 18616 13582 19398 16411 15552 578 14161 9621 19542 9684 1699 16733 9223 16474 19501 15178 3217 9743 11111 6539 14379 5655 12001 10637 2251 13411 7006 7104 9228 15833 19339 12622 4315 19092 7490 8033 12870 19399...
output:
2 3828 2 5873 2 10321 2 7554 2 6507 2 17619 2 1012 2 18616 2 19398 2 16411 2 578 2 9621 2 9684 2 16733 2 19501 2 3217 2 11111 2 6539 2 12001 2 2251 2 13411 2 9228 2 15833 2 4315 2 19092 2 8033 2 1103 2 12722 2 5264 2 3401 2 13502 2 15830 2 11848 2 464 2 16042 2 8567 2 4102 2 985 2 848 2 4426 2 8368 ...
result:
ok AC
Test #40:
score: 0
Accepted
time: 8ms
memory: 7552kb
input:
20000 6712 1 6712 16871 8572 16871 8572 10641 10641 16702 16702 18095 14014 18095 14014 10577 10577 1956 1956 13463 4593 13463 4593 17604 8524 17604 8524 4625 4625 5906 5906 17983 17983 13029 13029 7366 13038 7366 13038 3804 3804 3699 3699 15717 15717 967 16443 967 16443 1797 3079 1797 9213 3079 232...
output:
6712 2833 1 16871 1 8572 1 10641 1 16702 1 18095 1 14014 1 10577 1 1956 1 13463 1 4593 1 17604 1 8524 1 4625 1 5906 1 17983 1 13029 1 7366 1 13038 1 3804 1 3699 1 15717 1 967 1 16443 1 1797 1 3079 1 9213 1 232 1 16743 1 1222 1 4937 1 10300 1 9423 1 871 1 15884 1 11121 1 7931 1 15720 1 3455 1 16899 1...
result:
ok AC
Test #41:
score: 0
Accepted
time: 3ms
memory: 7624kb
input:
20000 2591 11751 5562 1300 9597 7814 11201 6762 9942 6089 18201 10054 14040 17666 14050 3479 2754 6286 5122 10070 2705 10053 3703 8076 33 13628 18330 17144 15031 16159 668 10414 14591 4857 15396 13207 6623 13987 3946 9270 15622 17484 4063 8811 12866 7551 3439 8748 10982 6076 15522 1678 8947 4749 677...
output:
1 11751 1 1300 1 9597 1 11201 1 6089 1 10054 1 17666 1 14050 1 6286 1 10070 1 10053 1 8076 1 13628 1 17144 1 16159 1 10414 1 4857 1 15396 1 6623 1 3946 1 17484 1 4063 1 7551 1 3439 1 6076 1 1678 1 4749 1 6774 1 19379 1 16853 1 7621 1 12599 1 10915 1 5651 1 12012 1 1957 1 11451 1 4213 1 15277 1 18381...
result:
ok AC
Test #42:
score: 0
Accepted
time: 24ms
memory: 10884kb
input:
100000 1 72500 1 89151 72500 50542 16422 72500 31678 89151 89151 54297 19071 50542 25039 50542 59896 16422 57305 16422 17263 31678 31678 3514 54297 25341 13381 54297 19071 7507 15806 19071 25039 62775 20433 25039 59896 28013 59896 2793 84857 57305 57305 84225 17263 6434 17263 61853 37741 3514 3514 8...
output:
72500 89151 1 50542 89151 50542 1 16422 1 31678 1 54297 1 19071 1 25039 1 59896 1 57305 1 17263 1 3514 1 25341 1 13381 1 7507 1 15806 1 62775 1 20433 1 28013 1 2793 1 84857 1 84225 1 6434 1 61853 1 37741 1 83001 1 44061 1 13085 1 58193 1 55647 1 77954 1 78764 1 76195 1 7022 1 9513 1 91918 1 49029 1 ...
result:
ok AC
Test #43:
score: 0
Accepted
time: 27ms
memory: 11300kb
input:
100000 37174 25594 26356 56758 70911 5299 53571 20298 89704 67180 69629 74497 31785 14492 10546 1814 71677 54029 2466 28838 57294 23003 35667 41920 5998 95159 14430 34895 74794 85483 87138 10195 54295 96087 21621 26770 92353 70922 56725 17254 67745 92044 30390 34948 64685 31050 54736 78533 63644 859...
output:
1 37174 1 26356 1 70911 1 20298 1 89704 1 74497 1 14492 1 10546 1 71677 1 28838 1 23003 1 41920 1 95159 1 34895 1 74794 1 10195 1 54295 1 21621 1 70922 1 56725 1 67745 1 30390 1 31050 1 78533 1 8591 1 41599 1 83052 1 72832 1 91279 1 67635 1 93515 1 12147 1 42902 1 62955 1 28269 1 74934 1 54184 1 527...
result:
ok AC
Test #44:
score: 0
Accepted
time: 35ms
memory: 10824kb
input:
100000 90403 1 90403 84049 84049 28339 50038 28339 50038 23735 23735 87291 87291 26404 26404 3276 3276 37488 67144 37488 67144 15335 15335 73596 32815 73596 58348 32815 32340 58348 77042 32340 32340 17210 58348 68281 68281 13360 68281 52957 32815 3781 88746 3781 33513 88746 88746 23338 11895 3781 90...
output:
90403 31209 1 84049 1 28339 1 50038 1 23735 1 87291 1 26404 1 3276 1 37488 1 67144 1 15335 1 73596 1 32815 1 58348 1 32340 1 77042 1 17210 1 68281 1 13360 1 52957 1 3781 1 88746 1 33513 1 23338 1 11895 1 90021 1 30580 1 48662 1 63248 1 74409 1 81851 1 86494 1 83685 1 90724 1 63215 1 55619 1 58689 1 ...
result:
ok AC
Test #45:
score: 0
Accepted
time: 26ms
memory: 10624kb
input:
100000 10753 1 31716 1 1 8354 41344 10753 10753 22340 33736 10753 31716 74747 24655 31716 31716 93736 4454 8354 65308 8354 36992 8354 53743 41344 59301 41344 41344 86462 22340 77782 22340 49193 90415 22340 33736 2126 72574 33736 33736 98153 92064 74747 23614 74747 74747 96121 24655 95702 47727 24655...
output:
10753 31716 31716 8354 1 41344 8354 41344 1 22340 1 33736 1 74747 1 24655 1 93736 1 4454 1 65308 1 36992 1 53743 1 59301 1 86462 1 77782 1 49193 1 90415 1 2126 1 72574 1 98153 1 92064 1 23614 1 96121 1 95702 1 47727 1 49727 1 66140 1 85606 1 19727 1 80356 1 40253 1 52474 1 57593 1 56468 1 11024 1 87...
result:
ok AC
Test #46:
score: 0
Accepted
time: 34ms
memory: 10712kb
input:
100000 82182 59525 43093 74187 83434 62328 30609 75691 98351 97443 93951 9234 89762 57868 66707 24839 91314 82444 9148 12031 46318 817 9254 56692 67828 19158 29614 79432 64090 86748 43645 44758 91501 26481 13108 70283 53676 76180 2183 16343 17086 64156 13813 38661 1934 69441 21652 50770 62980 13969 ...
output:
1 82182 1 74187 1 83434 1 30609 1 97443 1 93951 1 57868 1 24839 1 91314 1 9148 1 817 1 56692 1 67828 1 79432 1 64090 1 44758 1 26481 1 70283 1 76180 1 2183 1 17086 1 38661 1 69441 1 50770 1 13969 1 32887 1 53464 1 31201 1 75999 1 72413 1 94757 1 65182 1 73092 1 67989 1 9866 1 97622 1 27396 1 56173 1...
result:
ok AC
Test #47:
score: 0
Accepted
time: 1ms
memory: 5824kb
input:
7 1 6 2 1 2 3 2 4 5 6 7 6
output:
6 2 1 5 1 3 1 4 2 5 1 7
result:
ok AC
Test #48:
score: 0
Accepted
time: 32ms
memory: 10744kb
input:
100000 1 59819 46211 59819 46211 78631 78631 6887 6887 15685 45496 15685 45496 38399 38399 43932 22491 43932 22491 57782 25655 57782 57782 81578 40906 57782 22491 8185 8185 92518 96199 8185 63790 8185 22491 64847 84427 64847 34665 64847 30015 64847 34952 43932 34952 12997 41447 12997 19357 12997 307...
output:
59819 27108 1 46211 1 78631 1 6887 1 15685 1 45496 1 38399 1 43932 1 22491 1 57782 1 25655 1 81578 1 40906 1 8185 1 92518 1 96199 1 63790 1 64847 1 84427 1 34665 1 30015 1 34952 1 12997 1 41447 1 19357 1 30750 1 41985 1 17269 1 73496 1 97851 1 56846 1 2593 1 73876 1 90232 1 20892 1 3411 1 65784 1 17...
result:
ok AC
Test #49:
score: 0
Accepted
time: 19ms
memory: 11328kb
input:
100000 70720 1 71027 1 48338 1 1 61809 1 79963 1 39740 86644 1 14939 1 39918 1 41470 1 23364 1 1 54664 1 96370 1 53835 1 67313 33696 1 44243 1 50423 1 1 70539 73776 1 560 1 98363 1 71623 1 72365 1 1 73548 1 82843 1 64083 52686 1 1 44452 1 94601 1 43725 88136 1 1 65340 30989 1 1 94282 76705 1 1 4208 ...
output:
70720 79968 71027 94601 48338 71027 61809 48338 79963 61809 39740 79963 86644 39740 14939 86644 39918 14939 41470 39918 23364 73776 54664 560 96370 54664 53835 96370 67313 53835 33696 67313 44243 33696 50423 44243 70539 50423 73776 70539 560 41470 98363 56154 71623 98363 72365 71623 73548 72365 8284...
result:
ok AC
Test #50:
score: 0
Accepted
time: 24ms
memory: 11068kb
input:
100000 55448 49209 4084 16405 52470 22193 57007 13008 43787 82824 91893 67413 72105 89438 5791 85302 74502 44950 57906 11997 53465 42216 63894 41770 20892 54078 19530 68055 34937 22893 43941 47065 54015 53196 91519 81132 80483 71834 1399 53196 18226 23550 46619 51969 78131 47878 85576 60764 37319 88...
output:
1 55448 1 4084 1 22193 1 13008 1 82824 1 91893 1 72105 1 5791 1 44950 1 11997 1 42216 1 41770 1 20892 1 68055 1 22893 1 47065 1 54015 1 91519 1 80483 1 1399 1 23550 1 46619 1 47878 1 85576 1 37319 1 32182 1 81586 1 8618 1 79665 1 71947 1 32200 1 98413 1 2876 1 42148 1 83951 1 9727 1 95950 1 24562 1 ...
result:
ok AC
Test #51:
score: 0
Accepted
time: 27ms
memory: 11372kb
input:
100000 1 13485 13485 21238 21238 89751 21238 74621 14404 21238 60040 21238 21238 46089 46928 21238 73214 21238 88224 21238 47403 21238 21238 99205 89778 21238 21238 89464 22870 21238 21238 75159 40123 21238 33512 21238 21238 30257 70298 21238 21238 79591 57804 21238 21238 99840 64087 21238 12717 212...
output:
13485 51838 1 21238 1 89751 1 74621 1 14404 1 60040 1 46089 1 46928 1 73214 1 88224 1 47403 1 99205 1 89778 1 89464 1 22870 1 75159 1 40123 1 33512 1 30257 1 70298 1 79591 1 57804 1 99840 1 64087 1 12717 1 80599 1 94369 1 17735 1 40969 1 4985 1 18584 1 2198 1 19418 1 83752 1 84416 1 20892 1 61478 1 ...
result:
ok AC
Test #52:
score: 0
Accepted
time: 34ms
memory: 14292kb
input:
100000 43730 1 43730 8413 8413 13508 53025 13508 44444 53025 44444 46747 54535 46747 54535 16058 16058 27066 27066 73721 35961 73721 18398 35961 18398 3188 3188 9998 57229 9998 57229 96831 2109 96831 2109 89059 89059 89520 89520 62512 62512 9136 9136 32949 27353 32949 19993 27353 19993 17305 91005 1...
output:
2 1 2 43730 2 8413 2 13508 2 53025 2 44444 2 46747 2 54535 2 16058 2 27066 2 73721 2 35961 2 18398 2 3188 2 9998 2 57229 2 96831 2 2109 2 89059 2 89520 2 62512 2 9136 2 32949 2 27353 2 19993 2 17305 2 91005 2 89369 2 44544 2 62632 2 97627 2 63485 2 91766 2 7276 2 21832 2 27796 2 99690 2 25279 2 8244...
result:
ok AC
Test #53:
score: 0
Accepted
time: 33ms
memory: 14892kb
input:
100000 5616 54215 70847 24268 13256 88765 87054 72678 65173 1284 61132 24104 29759 37270 50005 62107 8909 58386 97772 68628 3463 41963 93835 10608 7780 68599 97385 40426 52295 15155 65521 84045 97372 22218 24089 69011 44236 64952 21273 33469 21618 31458 76924 4738 27278 21658 6790 18294 2343 82355 8...
output:
2 54215 2 24268 2 88765 2 72678 2 1284 2 61132 2 37270 2 50005 2 58386 2 97772 2 3463 2 10608 2 68599 2 40426 2 52295 2 65521 2 22218 2 69011 2 64952 2 33469 2 31458 2 76924 2 27278 2 18294 2 2343 2 9539 2 10328 2 83798 2 4010 2 71648 2 59096 2 94048 2 91691 2 863 2 50160 2 62216 2 96271 2 88708 2 8...
result:
ok AC
Test #54:
score: 0
Accepted
time: 20ms
memory: 10544kb
input:
100000 1 81565 21567 1 86484 1 95714 1 1 93565 1 15812 51087 1 15941 1 36746 1 1 34149 1 71887 1 61269 1 93111 1 52394 8732 1 1 62378 1 74176 1362 1 15806 1 91535 1 1 77121 1 17356 1 23401 70673 1 1 21367 77472 1 1 44692 1 45094 1 43652 62628 1 1 81187 1 98635 2258 1 1 491 1 1963 1 83580 12393 1 1 5...
output:
-1
result:
ok AC
Test #55:
score: 0
Accepted
time: 22ms
memory: 9756kb
input:
100000 62999 54230 62172 54230 54230 87813 80978 54230 54230 13635 8808 54230 34109 54230 54230 13451 54230 30179 9847 54230 93260 54230 54230 45610 54230 7282 54230 42958 54230 54480 54230 62452 54230 95890 32418 54230 54230 8456 54230 64404 54230 40018 54230 70843 38010 54230 57364 54230 95022 542...
output:
-1
result:
ok AC
Test #56:
score: 0
Accepted
time: 27ms
memory: 10848kb
input:
100000 85431 10525 82137 81079 48778 58755 215 90110 51120 51131 16823 69899 6320 72931 65015 30930 68354 78098 32070 13344 55633 13621 69157 69872 92675 79903 96312 24145 13234 89857 62310 15217 7671 50027 34561 73029 90324 42836 14988 3767 96314 18015 665 82164 49080 34432 24022 62814 89664 13182 ...
output:
2 85431 2 81079 2 48778 2 215 2 51131 2 16823 2 72931 2 30930 2 78098 2 13344 2 13621 2 69157 2 79903 2 24145 2 13234 2 15217 2 7671 2 73029 2 90324 2 3767 2 18015 2 665 2 49080 2 24022 2 13182 2 34581 2 15439 2 37149 2 98006 2 28737 2 556 2 21022 2 81316 2 25192 2 44380 2 29136 2 94415 2 22535 2 56...
result:
ok AC
Test #57:
score: 0
Accepted
time: 26ms
memory: 10848kb
input:
100000 54861 12509 16932 42872 34657 39417 13373 37054 53410 71695 2271 28730 77047 80422 7187 34867 94140 69441 47384 90599 15092 60892 94502 35186 58059 98865 46037 92080 96465 56648 81008 245 86644 72226 35703 96730 7922 3613 97616 90536 41294 92557 22776 10335 74308 16656 86493 81735 91472 93048...
output:
1 12509 1 42872 1 34657 1 37054 1 53410 1 28730 1 77047 1 7187 1 94140 1 47384 1 60892 1 35186 1 98865 1 46037 1 96465 1 245 1 86644 1 96730 1 3613 1 97616 1 41294 1 22776 1 74308 1 81735 1 93048 1 76450 1 54929 1 95864 1 61190 1 99747 1 14994 1 75 1 40957 1 3200 1 22509 1 10962 1 75699 1 67894 1 96...
result:
ok AC
Test #58:
score: 0
Accepted
time: 2ms
memory: 5816kb
input:
7 1 4 2 4 5 4 1 3 6 3 7 3
output:
4 3 1 2 1 5 3 2 1 6 1 7
result:
ok AC
Test #59:
score: 0
Accepted
time: 36ms
memory: 10784kb
input:
100000 88390 1 1 51242 1 73844 73844 82993 69357 82993 82993 89153 89153 92016 36977 89153 75137 36977 82993 53533 97404 53533 49989 97404 67125 49989 53533 7006 7006 63635 60387 7006 59312 60387 24309 59312 26526 24309 24309 9985 9985 26403 60387 55203 55203 79993 79993 71230 71230 52071 52071 8306...
output:
88390 51242 51242 82993 1 82993 73844 88390 1 69357 1 89153 1 92016 1 36977 1 75137 1 53533 1 97404 1 49989 1 67125 1 7006 1 63635 1 60387 1 59312 1 24309 1 26526 1 9985 1 26403 1 55203 1 79993 1 71230 1 52071 1 83065 1 86192 1 31224 1 95661 1 78908 1 55189 1 61764 1 20955 1 6350 1 92937 1 39888 1 3...
result:
ok AC
Test #60:
score: 0
Accepted
time: 24ms
memory: 13836kb
input:
100000 1 7264 7264 69649 85097 69649 29848 85097 29848 68683 68683 42523 15272 42523 97689 15272 97689 7996 30390 7996 54151 30390 22264 54151 22264 98123 98123 16751 27570 16751 9987 27570 9987 86950 86950 67445 67445 87275 8871 87275 8871 74967 74967 53362 53362 10217 10217 52404 45262 52404 45262...
output:
5 1 5 7264 5 69649 5 85097 5 29848 5 68683 5 42523 5 15272 5 97689 5 7996 5 30390 5 54151 5 22264 5 98123 5 16751 5 27570 5 9987 5 86950 5 67445 5 87275 5 8871 5 74967 5 53362 5 10217 5 52404 5 45262 5 72843 5 86772 5 18694 5 30955 5 43425 5 68130 5 6209 5 97483 5 6778 5 29735 5 60476 5 16825 5 1146...
result:
ok AC
Test #61:
score: 0
Accepted
time: 30ms
memory: 10656kb
input:
100000 3518 47523 14887 83452 31336 87320 47772 87482 71420 24559 99732 17539 45904 20872 52728 70439 38581 75203 18345 49294 7385 74056 95971 72826 48547 37020 61306 27212 53241 59530 32550 2892 5369 8488 4000 50453 45119 41435 5899 77096 19235 37917 75044 40239 44198 79848 23637 99807 40855 52471 ...
output:
2 3518 2 14887 2 87320 2 87482 2 71420 2 99732 2 20872 2 70439 2 38581 2 49294 2 7385 2 95971 2 37020 2 61306 2 53241 2 2892 2 8488 2 50453 2 45119 2 77096 2 37917 2 40239 2 79848 2 99807 2 52471 2 24560 2 59232 2 97918 2 85990 2 27308 2 80650 2 74356 2 61763 2 62302 2 28194 2 91879 2 91535 2 5717 2...
result:
ok AC
Test #62:
score: 0
Accepted
time: 26ms
memory: 14516kb
input:
100000 56405 1 56405 66063 66801 66063 66801 9845 9845 42911 42911 64818 67482 64818 35942 67482 35942 75546 75546 4505 4505 45628 45628 29159 29159 29378 83665 29378 83665 85205 85205 94326 78400 94326 91544 78400 92293 91544 95489 92293 20854 95489 20854 94810 91796 94810 91796 49331 49331 66242 9...
output:
56405 8284 1 66063 1 66801 1 9845 1 42911 1 64818 1 67482 1 35942 1 75546 1 4505 1 45628 1 29159 1 29378 1 83665 1 85205 1 94326 1 78400 1 91544 1 92293 1 95489 1 20854 1 94810 1 91796 1 49331 1 66242 1 9479 1 14120 1 30274 1 82180 1 62981 1 80630 1 92767 1 15026 1 37107 1 90649 1 16204 1 36373 1 98...
result:
ok AC
Test #63:
score: 0
Accepted
time: 38ms
memory: 13704kb
input:
100000 29993 41605 84963 10140 60237 62389 66780 93449 98439 1174 75487 87344 56945 1098 7281 10192 90231 22033 95031 94597 88728 56965 74791 64971 68584 15462 91264 43556 80943 25018 89575 23985 46970 91618 7237 89928 26433 7488 10258 93471 44420 34919 39007 60649 64537 14238 89107 56906 58805 7576...
output:
3 29993 3 84963 3 62389 3 66780 3 1174 3 87344 3 1098 3 7281 3 90231 3 95031 3 88728 3 74791 3 15462 3 43556 3 80943 3 23985 3 46970 3 7237 3 26433 3 93471 3 44420 3 60649 3 14238 3 56906 3 75769 3 48637 3 14216 3 61560 3 71181 3 43209 3 65213 3 890 3 20561 3 51092 3 76815 3 31667 3 54739 3 52808 3 ...
result:
ok AC
Test #64:
score: 0
Accepted
time: 23ms
memory: 10700kb
input:
100000 87758 1 87758 8566 8566 53230 53230 68035 45464 68035 43933 45464 7611 43933 7611 72530 72530 97898 97898 68231 2236 84498 71861 63091 76814 62314 24969 43571 98738 76356 71858 14301 12495 4041 49101 10912 83218 63817 60387 86854 59093 27607 35192 6135 76119 58917 15976 50822 5377 60508 39902...
output:
5 1 5 87758 5 8566 5 53230 5 68035 5 45464 5 43933 5 7611 5 72530 5 97898 5 84498 5 71861 5 76814 5 43571 5 76356 5 14301 5 4041 5 49101 5 63817 5 86854 5 59093 5 35192 5 76119 5 50822 5 5377 5 39902 5 62754 5 47841 5 23602 5 65106 5 72292 5 97173 5 64193 5 46660 5 64231 5 74997 5 7293 5 53179 5 889...
result:
ok AC
Test #65:
score: 0
Accepted
time: 28ms
memory: 10368kb
input:
100000 49400 1 1 55311 78355 1 58471 1 25325 1 8216 1 19123 1 47311 1 1 87302 68137 1 1 98931 11168 1 1 42489 44803 1 25464 1 34243 1 63702 1 29572 1 14941 1 1 46103 1 54830 43707 1 57172 1 1 17538 75154 1 67663 1 1 6784 14487 1 45840 1 1 82849 1 77260 1 18850 1 7003 1 76083 16640 1 54748 1 46731 1 ...
output:
49400 75540 55311 78355 78355 58471 58471 25325 25325 8216 8216 19123 19123 47311 47311 87302 87302 68137 68137 98931 98931 11168 11168 52326 42489 55311 44803 25464 25464 34243 34243 63702 63702 29572 29572 14941 14941 46103 46103 54830 54830 43707 43707 57172 57172 17538 17538 40033 75154 59833 67...
result:
ok AC
Test #66:
score: 0
Accepted
time: 38ms
memory: 10684kb
input:
100000 59098 1 88393 1 10097 1 1 27732 12542 1 1 74984 63414 1 1 68750 1 38087 65706 38087 46675 927 57918 60950 11844 60891 1200 51250 17750 31241 12177 66972 57772 85920 49826 92407 3739 18636 15328 31458 47706 69254 95722 85793 92734 12473 72338 65624 66312 27618 47426 68757 39713 32969 50029 618...
output:
59098 88393 88393 10097 10097 27732 27732 12542 12542 74984 74984 63414 63414 68750 68750 65706 1 65706 38087 59098 1 46675 1 60950 1 60891 1 51250 1 17750 1 66972 1 57772 1 49826 1 3739 1 31458 1 47706 1 85793 1 12473 1 72338 1 27618 1 68757 1 39713 1 61891 1 54472 1 65357 1 68498 1 43879 1 12766 1...
result:
ok AC
Test #67:
score: 0
Accepted
time: 0ms
memory: 6288kb
input:
5 2 1 1 3 4 1 5 4
output:
2 3 3 5 1 5 4 2
result:
ok AC
Test #68:
score: 0
Accepted
time: 2ms
memory: 5936kb
input:
5 4 1 3 1 5 1 5 2
output:
4 3 3 2 1 2 5 4
result:
ok AC
Test #69:
score: 0
Accepted
time: 0ms
memory: 5980kb
input:
5 5 1 3 1 1 2 2 4
output:
5 3 3 4 1 4 2 5
result:
ok AC