QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#393172 | #1884. Mission Impossible: Grand Theft Auto | Slongod | AC ✓ | 56ms | 24720kb | C++17 | 2.4kb | 2024-04-18 11:24:55 | 2024-04-18 11:24:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
namespace Slongod{
constexpr int N = 2e5+7 , inf = 0x3f3f3f3f;
int n , m , root , ans , add_flag , lefn[N] , dfn[N] , rdfn[N]; vector <int> g[N] , lef;
void dfs(int u , int fa)
{
dfn[u] = int(lef.size());
if (g[u].size() == 1){lef.push_back(u);}
for (auto v : g[u]) {
if (v != fa) {
dfs(v , u);
}
} rdfn[u] = int(lef.size());
}
void main()
{
auto clear = [&]() {
for (int i = 1; i <= n + 1; i++) {
vector<int>().swap(g[i]); lefn[i] = 0;
} m = 0; root = 0; lef.clear(); add_flag = 0; ans = 0;
};
int T; cin >> T;
while(T--) {
cin >> n; clear();
for (int i = 1 , u , v; i < n; i++){cin >> u >> v; g[u].push_back(v); g[v].push_back(u);}
for (int i = 1; i <= n; i++){m += (g[i].size() == 1); root = (g[i].size() > 2 ? i : root);}
if (m == 2) {
for (int i = 1; i <= n; i++){if (g[i].size() == 1){cout << i << ' ';}} cout << '\n';
for (int i = 1; i <= n; i++){if (g[i].size() == 1){cout << i << ' ';}} cout << '\n';
cout << '\n'; continue;
} else if (m % 2 == 0){
n++; g[n].push_back(root); g[root].push_back(n); add_flag = 1;
} dfs(root , root); m = int(lef.size());
for (int i = 1; i <= n; i++) {
if (g[i].size() > 2) {
if (!((rdfn[i] - dfn[i]) & 1)) {
lefn[(rdfn[i]+dfn[i]) / 2 - 1]++;
} else if (rdfn[i] - dfn[i] != m) {
lefn[((dfn[i]+m+rdfn[i]) / 2 - 1) % m]++;
}
}
} lefn[0] = inf;
for (int i = 0; i < m; i++) {
if (lefn[i] < lefn[ans]) {
ans = i;
}
} assert(!lefn[ans]);
auto print = [&](int x , int y) {
x = (x + m) % m; y = (y + m) % m;
if (x == y){y = (y + 1) % m;}
x = lef[x]; y = lef[y];
if (x == n and add_flag){x = root;}
if (y == n and add_flag){y = root;}
cout << x << ' ' << y << '\n';
};
for (int i = 0; i < m / 2 + 1; i++) {
print(ans - i , ans + i + 1);
} cout << '\n';
}
}
}int main()
{
#ifndef ONLINE_JUDGE
freopen("in.in" , "r" , stdin);
#endif
ios :: sync_with_stdio(0);
cin.tie(0) , cout.tie(0);
return Slongod :: main(),0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 8864kb
input:
4 5 1 2 1 3 1 4 1 5 4 1 2 2 3 3 4 5 1 2 1 3 2 4 2 5 6 1 2 2 3 2 4 4 5 4 6
output:
3 4 2 5 1 2 1 4 1 4 4 5 3 4 3 5 1 6 4 1
result:
ok All OK (4 test cases)
Test #2:
score: 0
Accepted
time: 37ms
memory: 9284kb
input:
100 2000 494 1815 316 280 704 103 1627 787 475 1616 401 744 1003 1901 46 66 428 1703 1865 450 1645 852 146 1488 469 1825 104 332 1638 1941 127 468 1558 350 373 1492 1287 1809 76 1479 1653 1243 1292 1465 922 1497 1891 459 1347 176 1996 1377 1182 1570 1461 742 1972 984 355 1412 650 338 1708 121 1869 1...
output:
1659 1825 1954 1864 2000 1419 144 1164 45 1642 7 1265 1089 422 693 1070 1916 456 215 713 283 1282 1325 1005 412 914 663 1356 743 509 384 805 1117 188 113 772 777 1434 1872 278 1973 1220 1364 1467 486 1333 1119 1747 1925 723 612 1115 1848 1643 79 440 545 1892 1351 518 1485 592 1780 768 821 1206 524 1...
result:
ok All OK (100 test cases)
Test #3:
score: 0
Accepted
time: 32ms
memory: 10396kb
input:
100 2000 1312 1335 1335 1706 1913 1335 1335 896 1335 990 892 1335 1592 1335 1335 213 808 1228 1228 999 1335 332 1430 1335 1335 145 1335 901 1335 1269 1335 564 1335 843 1335 138 493 1335 1707 1335 1335 1368 754 1335 293 1335 1095 1335 355 1335 341 1335 37 1335 1335 1881 1455 1335 605 1335 1335 1322 1...
output:
1706 1913 1312 896 1335 990 837 892 634 1592 1858 213 1738 332 469 1430 1968 145 1029 901 1294 1269 1602 564 1632 843 410 138 199 493 1085 1707 928 1368 215 754 1409 293 323 1095 1214 355 67 341 1895 37 423 1881 876 1455 1243 605 1456 1322 1930 104 1740 59 494 1699 75 1596 90 1501 660 1561 348 840 1...
result:
ok All OK (100 test cases)
Test #4:
score: 0
Accepted
time: 25ms
memory: 9444kb
input:
100 2000 478 1228 1201 702 874 1106 1043 1608 1010 1698 485 1592 1760 365 369 190 1268 104 250 1182 1530 1793 825 1236 1245 260 1818 551 626 652 979 1565 161 624 1302 1163 1109 1065 353 1342 1181 696 56 1061 905 396 411 1769 671 1715 1487 1906 761 1975 292 346 1889 175 527 1717 965 1780 1296 97 992 ...
output:
344 713 344 713 401 1059 401 1059 289 1569 289 1569 1072 1845 1072 1845 498 584 498 584 625 832 625 832 400 1656 400 1656 252 631 252 631 297 1451 297 1451 540 1379 540 1379 920 1475 920 1475 1598 1613 1598 1613 853 1645 853 1645 137 908 137 908 140 1204 14...
result:
ok All OK (100 test cases)
Test #5:
score: 0
Accepted
time: 33ms
memory: 9740kb
input:
100 2000 1631 317 85 1099 180 616 35 1047 1478 164 1433 959 410 1733 371 1716 1885 1962 217 433 981 872 564 942 1370 655 142 718 1513 1897 1694 683 373 686 1965 833 384 1195 1430 1316 770 787 1456 292 831 166 834 1221 288 716 252 311 1974 1497 391 1603 675 369 542 141 1542 225 741 558 1762 1612 701 ...
output:
20 1184 1290 1786 1993 1158 155 821 763 226 844 1987 1878 1209 1983 1830 1547 1874 11 261 372 1165 1148 685 1595 1777 140 128 579 756 387 577 1097 1809 1606 216 204 1819 808 469 1967 1315 1353 1341 1896 1988 1771 1894 752 321 869 1529 1919 1670 730 1799 669 948 932 1314 353 864 1334 765 381 1996 733...
result:
ok All OK (100 test cases)
Test #6:
score: 0
Accepted
time: 34ms
memory: 9116kb
input:
100 2000 409 1935 85 1581 372 298 566 1538 462 1618 953 1566 1800 1220 1394 1061 553 318 1961 455 1318 168 935 339 1221 352 758 1219 1285 1093 889 948 1808 1849 446 801 1123 623 562 289 1923 5 1061 1276 618 523 865 1287 1143 1708 285 542 1545 1439 1350 72 2 999 956 1197 36 931 35 840 733 352 1481 39...
output:
649 252 1829 486 2000 670 1684 1330 539 260 1976 1213 1769 26 1244 655 1358 1027 444 1326 694 1176 1241 1599 101 1347 1594 1423 1767 1158 1284 458 1419 626 1914 1352 841 777 1844 653 103 1680 1751 1396 769 117 1446 715 1656 382 251 383 1571 1800 79 913 1041 1754 1021 1301 698 540 364 59 821 1950 357...
result:
ok All OK (100 test cases)
Test #7:
score: 0
Accepted
time: 36ms
memory: 9848kb
input:
100 2000 360 1067 1071 386 1972 39 630 1817 68 777 91 353 683 1737 657 724 646 448 665 630 337 267 1274 769 977 1075 1177 93 122 1181 302 358 807 1078 1593 428 1301 563 485 1656 64 395 156 628 957 998 516 671 1809 556 765 1143 568 62 585 80 278 1533 38 373 593 1051 614 1262 929 1341 840 52 68 871 11...
output:
1728 1575 1223 1739 1677 1356 1217 1551 1351 1633 1743 1282 1674 1835 1331 1464 1660 1318 1838 1494 1997 1766 1599 1173 1589 1365 1197 1274 1376 1414 1500 1699 1302 1623 1956 1758 1261 1546 1611 1421 1694 1605 1668 1470 1260 1920 1202 1549 1446 1143 1480 1320 1798 1959 1915 1885 1961 1935 1688 1238 ...
result:
ok All OK (100 test cases)
Test #8:
score: 0
Accepted
time: 56ms
memory: 17080kb
input:
1 200000 180867 117149 64957 96383 113663 34055 126334 46258 198365 156064 185941 135514 50922 102839 194187 170033 14353 188814 90500 114303 110852 84786 31360 45707 95366 181909 148219 102709 159594 15576 168829 128189 45621 36147 188648 157263 128090 120720 127728 147491 14102 46730 33752 29598 6...
output:
122338 130072 114115 27414 1388 91948 24358 85388 200000 78255 16527 35142 92191 145329 154577 196090 21286 173195 156367 59621 59665 90079 15825 123749 61532 10058 184773 75962 63418 122882 58539 124071 75507 70066 173443 20577 139918 145150 64892 143980 96711 26660 66200 57928 139058 169086 174636...
result:
ok All OK (1 test case)
Test #9:
score: 0
Accepted
time: 51ms
memory: 17516kb
input:
1 200000 57440 116519 190896 104071 53012 156570 169755 24088 100818 109488 68779 96300 13283 199209 78123 93290 132729 23440 24264 45870 149108 173718 111047 115843 65821 56899 148506 51951 89726 142789 25286 193684 68947 178839 187345 179659 4349 165429 4425 40651 170136 128767 79833 30317 146012 ...
output:
594 41213 48337 118463 177578 132533 133169 108268 81895 62983 115145 18303 198366 132502 158108 59036 66423 19845 43674 194891 163407 84348 174722 65924 122364 62403 72359 47092 74205 55170 84148 46164 102600 185005 88974 96870 58699 119025 196776 52756 67640 147489 194668 98722 128394 45952 26022 ...
result:
ok All OK (1 test case)
Test #10:
score: 0
Accepted
time: 45ms
memory: 18928kb
input:
1 200000 135363 12419 12419 53087 12419 102176 12419 88147 12419 195924 12419 70946 12419 28021 12419 158923 143022 12419 12419 94981 111088 12419 12419 15202 12419 46491 128055 12419 12419 36839 167823 12419 12419 139603 12419 78361 85762 12419 117686 12419 88163 12419 153517 12419 72620 12419 5023...
output:
53087 102176 135363 88147 61482 195924 55565 70946 10395 28021 159108 158923 139212 143022 198981 94981 105173 111088 176731 15202 197124 46491 80843 128055 48685 36839 71004 167823 154496 139603 160885 78361 41693 85762 100335 117686 189246 88163 138844 153517 137960 72620 154791 50230 22212 100434...
result:
ok All OK (1 test case)
Test #11:
score: 0
Accepted
time: 33ms
memory: 16852kb
input:
1 200000 135705 108920 162642 126519 85128 45728 194271 180875 30763 93992 52969 151747 177074 20263 186614 109737 36694 190088 187500 16286 142641 75314 64550 33705 164299 102609 157504 28107 33788 158382 126297 44905 99420 168255 156403 81775 79011 196380 131864 94044 69591 100898 128825 102920 90...
output:
114579 132040 114579 132040
result:
ok All OK (1 test case)
Test #12:
score: 0
Accepted
time: 56ms
memory: 24720kb
input:
1 200000 165592 104127 37950 12293 64975 97946 93785 166716 164318 69986 196751 90865 23447 160715 54234 71862 85060 175999 184004 138041 150985 163147 85042 49367 159900 58574 85526 126934 144113 74917 11820 71982 98279 154765 15130 123668 24221 153534 45841 90041 76611 84919 102872 179527 184300 2...
output:
17607 15131 172126 91416 136048 71203 36215 173879 103214 8814 28042 120204 190956 173971 129022 96872 154025 147810 179980 199881 97224 130754 101260 113656 186791 132871 40922 187909 175997 41755 145141 84565 5925 140092 20598 147986 102301 89928 40762 26712 138966 164700 15002 23559 52822 103163 ...
result:
ok All OK (1 test case)
Test #13:
score: 0
Accepted
time: 46ms
memory: 17208kb
input:
1 200000 11163 181049 198878 80756 126047 10444 12318 170212 53148 108157 36484 184447 112205 28414 134930 72219 20670 20296 192695 128565 76596 10779 157783 84654 92158 63822 184965 173701 167017 53897 149981 198928 90046 175838 111705 34219 68811 89794 177259 199009 17328 121104 29446 68600 72687 ...
output:
173212 61232 44957 32367 199994 38880 110709 100141 43262 149247 176774 90897 166918 32443 194206 141541 109160 99685 119772 120551 141703 54986 198239 46663 8582 27455 4975 109813 131485 53908 77277 21708 26356 36849 195557 47113 96153 21212 153546 6121 107417 115623 9797 147681 178314 76192 175462...
result:
ok All OK (1 test case)
Test #14:
score: 0
Accepted
time: 55ms
memory: 17284kb
input:
1 200000 4575 157468 164012 29131 19086 4026 40781 82891 37731 171364 63302 48036 74202 63605 197957 9856 13617 144515 52209 38724 21317 198083 80992 109217 166602 47381 33797 138331 25902 180272 167967 4317 61778 14894 56463 176107 190512 68141 73749 194304 28584 199885 34348 147657 17957 34484 492...
output:
167123 157805 93620 127419 93778 189968 100863 164634 139404 175318 147168 111285 102082 199354 129272 164030 131038 142656 132080 196111 153390 121776 169271 140235 94979 115136 104696 148658 181048 132792 180332 125327 166486 123801 186120 124529 192681 173217 125886 197603 102847 137272 127012 18...
result:
ok All OK (1 test case)
Test #15:
score: 0
Accepted
time: 35ms
memory: 10524kb
input:
10 20000 16695 1396 13278 3074 12587 14482 7700 15666 17027 19304 8306 4095 18254 12845 3902 15666 14183 1654 4204 14818 17061 8366 4939 9287 10390 13577 18352 7584 2963 12724 16669 3812 11375 11829 1776 12158 13184 13187 4759 587 19649 6559 14340 18587 10756 18874 8109 5657 1744 9320 5211 2432 8530...
output:
17314 11993 4298 5765 19998 9119 6896 13951 10050 17169 19982 535 11114 5262 12615 1968 4708 2665 9589 4019 14512 12734 3667 5139 1676 1847 4732 5154 12030 13211 2364 4316 7099 370 12375 17922 14619 14044 17062 5875 17507 11219 18603 12616 12306 18346 13229 9107 5718 19467 9598 3342 12224 1442 7234 ...
result:
ok All OK (10 test cases)
Test #16:
score: 0
Accepted
time: 32ms
memory: 10672kb
input:
10 20000 2348 3282 5666 6279 5192 9950 18034 567 7661 12644 174 3177 4119 2354 9049 17783 16454 17069 18214 8601 17570 12771 10226 14634 14460 9186 4607 15080 12090 9391 5717 14991 12948 9659 5416 18709 19886 14470 12463 15501 17018 11949 11693 15997 8454 18550 403 2082 14833 18785 11044 11985 16832...
output:
13417 16821 13417 16821 3531 12180 3531 12180 5855 16588 5855 16588 11685 14039 11685 14039 9995 17242 9995 17242 2902 14871 2902 14871 654 8286 654 8286 5659 14901 5659 14901 6997 19044 6997 19044 5298 14536 5298 14536
result:
ok All OK (10 test cases)
Test #17:
score: 0
Accepted
time: 41ms
memory: 12432kb
input:
10 20000 10174 13411 3604 8329 19065 11752 9275 11429 5176 4143 7231 7102 10510 4779 7622 17899 13285 10649 537 13311 12745 6710 7318 15748 3795 6401 4566 18704 2280 9793 10628 15036 2979 4111 5315 2728 15154 5630 10512 9624 4389 1280 15002 1310 17714 11820 14385 16888 8595 11794 15253 6282 15438 78...
output:
7535 4964 9881 4117 9496 10852 17445 16189 8836 6222 18173 530 13293 2720 950 5407 1685 3881 4802 8798 1095 9343 10202 15810 7008 17935 9087 17760 3431 15287 3006 14894 1177 12710 8420 15448 17804 2648 19154 19661 14674 12250 13743 13847 19708 11095 14807 8118 12107 14283 17547 19624 12801 12182 375...
result:
ok All OK (10 test cases)
Test #18:
score: 0
Accepted
time: 41ms
memory: 10128kb
input:
10 20000 6546 12178 8132 12698 9866 18394 4178 19311 18441 13775 13427 19385 9035 5234 18814 5897 13260 16823 240 19280 6194 12827 4971 193 12542 18512 18421 10994 1982 7222 17769 11520 19515 3324 7202 1207 11012 5144 9602 8684 11427 18573 4797 3230 10966 16392 331 4055 1990 9346 13 16133 12222 1776...
output:
12491 7339 8090 1333 19994 11433 4593 13756 449 6647 8136 10801 811 18037 14192 8222 11705 3563 11690 13500 13057 852 6779 6939 12849 6117 18971 4824 16223 5885 12822 1014 10552 18629 3741 2301 16896 1440 18248 13959 146 16985 6569 16718 11973 9651 10009 1140 9992 10660 8619 19334 17681 11659 8792 1...
result:
ok All OK (10 test cases)
Test #19:
score: 0
Accepted
time: 38ms
memory: 11476kb
input:
10 20000 18936 14226 19263 5838 8618 484 11997 12065 7555 4853 11170 19861 10053 8023 4674 1225 5681 11205 15958 2512 19545 13874 13344 14575 12557 12982 62 18520 4294 6383 14307 12269 9064 3353 12435 8926 5232 17514 2223 12758 16561 9385 15839 3786 5596 10714 2554 2704 7760 824 4795 4020 2501 9033 ...
output:
17356 19877 17788 19280 15451 18160 15086 18932 17380 17289 19364 15310 16988 18723 17202 18139 15185 15524 18827 17264 19392 15912 17916 17685 18764 19641 19546 16234 18770 19237 15799 15367 15662 19532 15166 16967 18080 16560 17510 17614 17424 16497 19728 16185 19461 18865 19206 17550 19620 19878 ...
result:
ok All OK (10 test cases)
Test #20:
score: 0
Accepted
time: 26ms
memory: 10900kb
input:
10 11312 7739 10213 4181 1027 4170 7024 9225 10206 3822 145 3713 8243 8815 1327 9962 736 318 1662 8562 48 9326 1002 5043 6009 928 8908 3571 837 10470 5661 3748 5909 1152 187 9538 2676 10704 8317 10457 4962 6777 9326 4163 4816 9384 6962 10183 531 4923 10222 9244 1092 10966 4894 8100 2154 10098 10331 ...
output:
9885 9059 10032 4336 9401 5551 8910 7467 11311 7197 5435 5092 4426 8365 790 2413 10535 1143 10688 1703 7137 5207 6069 10475 3396 9083 9190 9268 3167 876 6954 1129 6129 3845 1814 360 10181 1205 9674 3858 4586 10019 1854 3083 6781 7274 11286 2787 4620 9027 10406 5588 3236 4874 10156 3529 9868 8303 388...
result:
ok All OK (10 test cases)
Test #21:
score: 0
Accepted
time: 21ms
memory: 10052kb
input:
10 13449 12764 12936 5002 12959 8845 11434 4091 11415 4894 5002 5002 10608 8931 11149 5002 12709 9384 5473 690 8789 6033 4091 9384 6638 3921 853 9961 2907 3844 8931 7903 5040 4091 12458 8931 5188 5002 434 11434 3951 9380 11136 2487 8789 1878 8789 8931 12432 11095 11860 9380 9963 5457 9384 1460 3160 ...
output:
11640 7077 12764 8750 11721 1686 518 7004 8786 10400 3747 2947 2960 8854 328 2229 10744 3815 194 8639 3147 12991 3728 10466 686 4034 5748 1109 9437 9726 2208 8950 4491 11081 10501 1708 10604 9308 2476 11861 4648 11308 10114 3419 1365 5967 9494 3046 397 2383 1061 4862 5116 2290 85 8145 4638 12562 114...
result:
ok All OK (10 test cases)
Test #22:
score: 0
Accepted
time: 25ms
memory: 11176kb
input:
10 14493 1833 13275 4628 13795 12867 5331 6564 9403 2075 824 4339 8792 7565 7906 3377 4104 4897 11749 4166 279 8310 8908 7842 11805 12951 8243 1363 10049 10426 6105 9824 3042 13787 4927 10620 13711 1528 8158 3726 7386 10532 13174 7863 5049 2000 10370 8750 10724 13438 11506 9107 1969 8538 9710 12047 ...
output:
2864 8179 2864 8179 3471 12882 3471 12882 5072 14829 5072 14829 8734 17332 8734 17332 156 8474 156 8474 13894 18999 13894 18999 1990 6687 1990 6687 292 7642 292 7642 56 7508 56 7508 4697 8655 4697 8655
result:
ok All OK (10 test cases)
Test #23:
score: 0
Accepted
time: 27ms
memory: 11276kb
input:
10 14128 4498 9745 468 10727 4183 2924 10397 10422 1609 3728 10527 7958 5257 11781 7375 7137 13836 9986 7752 10497 13775 5728 5447 5105 6533 1593 9563 6546 7393 5921 9997 4083 11092 6797 13298 4550 13289 13066 4846 12542 4781 9790 11309 12700 1777 205 3315 1167 8709 13799 10721 12965 10146 7479 4004...
output:
1373 9733 4302 4991 8465 9919 10804 2578 9500 5523 11047 3282 4834 1385 7475 9773 4948 1477 12126 12325 3894 4063 10215 1889 13194 13926 4711 1849 5321 4787 10211 7751 6270 13498 6011 3779 10445 9871 2619 1092 8115 12585 6417 962 2550 6374 279 916 1140 2406 2782 5946 11737 12796 4914 8189 13553 1223...
result:
ok All OK (10 test cases)
Test #24:
score: 0
Accepted
time: 27ms
memory: 10624kb
input:
10 14665 1098 13101 7459 8501 3771 4992 6274 13209 9606 1624 2135 2263 5347 1754 14289 503 10856 301 8122 3811 3486 4024 9088 13875 1278 5408 5225 11456 5308 1475 2986 11799 9520 13971 12003 4141 3747 7910 1139 3798 11481 864 9160 7180 388 12570 7448 9300 4447 4504 6907 8665 11666 12682 11943 12211 ...
output:
7965 12182 10609 8802 14661 9048 10787 1149 10032 637 5968 3393 316 14624 852 10166 8849 14106 3944 4546 5610 10295 3060 10860 12722 4313 5753 9056 9924 8709 2375 1605 2580 1761 2459 3618 14337 9970 1374 3378 5996 1356 10078 7891 10381 2998 5263 1150 13041 3019 11813 7607 13170 1774 4017 11067 12797...
result:
ok All OK (10 test cases)
Test #25:
score: 0
Accepted
time: 28ms
memory: 9848kb
input:
10 14823 13851 10092 4469 5824 10539 681 5633 4009 11591 2052 9154 2692 2257 4439 7270 391 8135 8998 10371 6008 7953 1123 1917 13346 4253 8134 3141 13970 7216 8485 7217 8044 11904 9026 6879 6256 1758 5875 9127 13292 9266 3451 9418 956 5396 4746 12136 13171 438 5174 4770 8211 4249 10630 11931 7668 30...
output:
13055 13618 13855 14178 14637 13836 13687 14646 13443 13353 12971 14189 13056 13541 12892 12738 12787 12708 14587 13234 14416 13872 13284 14344 13841 13553 14469 14685 14498 14338 13447 13937 12888 14610 14590 13205 14631 13440 13362 14442 13360 13514 14209 13174 14566 14693 13274 12905 12749 14526 ...
result:
ok All OK (10 test cases)
Test #26:
score: 0
Accepted
time: 27ms
memory: 10476kb
input:
10 17485 5940 14053 2276 5018 8057 1985 12859 3478 12866 1646 5885 12915 15736 3531 17200 2938 6878 13777 10761 6120 4713 14167 2618 16233 5813 6420 13393 4642 9632 2985 1342 16025 16026 6844 6319 1649 5802 1215 2849 11681 15859 413 7453 3222 9492 5313 2309 13965 1361 8932 8017 5935 2256 7595 3056 8...
output:
17241 17220 17428 16758 16925 16933 16593 16772 16140 16623 17098 16606 17100 17485 17007 17358 17088 17099 16431 16151 16750 16913 16321 17114 16552 16814 16440 16437 17467 16253 16169 16971 17278 16908 17266 16446 17037 16192 17120 17408 16725 17203 17349 17018 16927 17233 16386 16785 17122 16656 ...
result:
ok All OK (10 test cases)
Test #27:
score: 0
Accepted
time: 35ms
memory: 9652kb
input:
10 20000 7885 7071 16024 2454 788 1532 9107 5396 863 18365 13559 14595 5682 17596 10277 5565 5429 9775 9651 1543 10997 1585 15843 98 11709 18346 18893 357 19664 6276 4638 4202 11311 4463 13733 1689 19245 7795 4812 13596 11676 16057 16039 7395 9202 12081 19418 3855 10091 15515 9706 18698 16415 17647 ...
output:
19270 18970 19366 19565 19779 19332 19790 18775 18733 18760 18974 18819 19367 19210 18811 19605 19937 19492 19273 18798 19604 19569 19691 18915 19610 19228 18743 19583 19496 19750 19375 18850 19430 18809 19353 19545 19734 19588 19253 19884 19622 19286 19692 19737 19096 19701 19219 19412 19620 18848 ...
result:
ok All OK (10 test cases)
Test #28:
score: 0
Accepted
time: 39ms
memory: 10360kb
input:
10 20000 13043 670 237 4915 10906 409 19253 711 16317 876 742 15465 12586 690 796 16349 6763 627 868 3775 13797 715 13416 216 6989 798 136 8115 17811 451 18310 626 8943 534 376 1364 629 17957 719 5463 4847 46 3220 704 735 19173 17824 290 803 12001 9695 326 3717 696 156 16563 394 6627 3829 779 267 14...
output:
10566 19204 11102 9853 930 12195 14574 1567 3452 18952 8844 6748 19825 2048 17697 6093 5246 4385 4576 1315 6369 17732 1293 17151 2476 14079 2867 13189 12186 10135 1702 9283 3610 17328 3524 2040 8205 5584 4540 16369 1515 13874 8908 13077 17360 4953 4596 18283 14286 4940 13085 9977 6296 19384 8074 166...
result:
ok All OK (10 test cases)
Test #29:
score: 0
Accepted
time: 31ms
memory: 10196kb
input:
100 2000 1527 25 35 1691 1381 12 1214 51 67 1058 67 1122 195 75 883 16 316 30 13 645 75 577 34 604 1988 32 86 9 47 579 1453 38 97 431 727 83 1939 26 1533 97 68 1142 80 1675 39 1352 45 1302 96 154 49 1402 26 1388 1091 93 70 1804 97 1577 77 28 1667 20 5 1602 189 21 545 42 10 1495 13 337 30 6 1799 7 52...
output:
117 1931 1391 989 98 1775 1566 936 1934 1102 768 1731 249 761 1818 1198 1856 1180 1626 1191 1942 1735 170 1532 1127 280 914 1616 1345 470 924 703 1435 666 1629 706 421 1894 365 582 295 1258 1655 1455 735 1192 450 1036 219 617 158 1309 712 401 267 939 1516 770 1166 860 781 1728 1780 322 1774 138 1820...
result:
ok All OK (100 test cases)
Test #30:
score: 0
Accepted
time: 28ms
memory: 9576kb
input:
100 2000 420 1219 945 1001 574 759 1646 1989 741 1939 54 210 1344 1645 832 1111 1685 1932 1581 612 1481 640 1634 928 971 924 136 1844 813 1516 860 331 103 1243 381 1348 839 849 423 1443 1766 1675 1462 513 961 1563 793 1687 378 279 1305 1510 818 966 668 1327 1133 1012 1356 1630 819 1261 70 521 1314 6...
output:
1984 1993 1986 1980 1983 1996 1994 1981 1987 1989 1999 1982 1998 1991 1990 1997 1985 1979 1978 1992 2000 1995 1988 2000 1927 1987 1949 1933 1968 1923 1943 1922 1966 1930 1985 1954 1936 1983 1951 1932 1977 1984 1981 1940 1982 1926 1956 1931 1918 1929 1946 1974 1948 1994 1989 1963 1916 1992 1939 1938...
result:
ok All OK (100 test cases)
Test #31:
score: 0
Accepted
time: 49ms
memory: 18908kb
input:
1 200000 75527 3156 2623 154626 2558 177113 146357 1358 2656 186051 187792 523 4363 90605 100704 4773 87808 3697 502 173074 86283 3548 197007 2319 2809 174049 52610 666 1359 164293 25456 2472 4304 188852 4561 165894 180375 3811 5190 90244 199525 659 23244 4464 142850 282 690 124332 164450 5136 15018...
output:
84219 198801 93610 170127 27853 49925 160808 111684 39216 72009 128348 28437 121694 91645 103109 54456 152653 157543 192968 51562 78207 8848 143195 185788 117673 25897 15055 121219 195936 53860 173965 104995 65534 173524 126232 192204 48008 7190 79819 141705 182923 185045 26939 190439 120433 137491 ...
result:
ok All OK (1 test case)
Test #32:
score: 0
Accepted
time: 41ms
memory: 23580kb
input:
1 200000 83931 96937 32952 195907 78310 37108 176347 23132 188809 37384 140706 23700 17636 158568 5634 155262 58194 33410 47523 166455 128642 18909 178740 165831 85365 160502 187890 58358 25450 91847 140606 122655 63185 138517 189170 33052 136599 125275 91736 43965 108429 73952 40581 92844 147701 19...
output:
199991 199997 199992 199998 199999 199993 200000 199989 199994 199996 199990 199988 199995 199990
result:
ok All OK (1 test case)
Test #33:
score: 0
Accepted
time: 51ms
memory: 17524kb
input:
1 200000 193597 17230 27229 185684 159770 185467 10684 16681 197494 65016 145960 136670 147327 154108 79903 91787 146348 95359 23027 12513 23620 155067 337 181961 81189 147340 97553 64534 60153 114240 87847 125869 29991 186766 75418 153252 30768 107217 128834 162883 28777 29024 94836 138175 140266 1...
output:
199665 199638 199221 199219 199185 199625 199770 199571 199077 199186 199888 199499 199203 199550 199946 199778 199141 199686 199698 199314 199956 199501 199315 199132 199747 199854 199864 199703 199609 199662 199234 199971 199939 199862 199806 199791 199651 199885 199131 199253 199838 199389 199890...
result:
ok All OK (1 test case)