QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#488928 | #1884. Mission Impossible: Grand Theft Auto | xlwang | AC ✓ | 51ms | 32556kb | C++14 | 4.2kb | 2024-07-24 16:24:04 | 2024-07-24 16:24:05 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
#define pii pair<int,int>
#define mk make_pair
using namespace std;
inline int read(){
int x=0;
bool f=0;
char c=getchar();
while(!isdigit(c)) f|=(c=='-'),c=getchar();
while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
return f?-x:x;
}
inline void write(int x){
if(x<0){putchar('-');x=-x;}
if(x>9)write(x/10);
putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int randfind(int l,int r){return rnd()%(r-l+1)+l;}
const int Maxn=2e5+10;
vector<int> vc[Maxn];
int d[Maxn];
int n;
int rt,m;
int L[Maxn],R[Maxn];
int id[Maxn];
int leaf[Maxn],idx;
vector<pii> limit[Maxn];
vector<pii> ans;
inline void clear(){
fr(i,1,n+1) d[i]=L[i]=R[i]=id[i]=leaf[i]=0,vector<int> ().swap(vc[i]);
}
inline void dfs(int x,int fa){
L[x]=idx+1;
for(auto y:vc[x]) if(y!=fa) dfs(y,x);
if(d[x]==1) ++idx,leaf[idx]=x;
R[x]=idx;
if(L[x]==R[x]) return;
// cout<<x<<' '<<L[x]<<' '<<R[x]<<endl;
if((R[x]-L[x]+1)%2==0){
limit[(R[x]+L[x])/2].pb(mk(L[x],R[x]));
// printf("limit:%d\n",(L[x]+R[x])/2);
}
else {
int s=L[x]-1+m-R[x];s/=2;
s=(R[x]+s);if(s>m) s-=m;
limit[s].pb(mk(L[x],R[x]));
// printf("limit:%d\n",s);
}
}
int lim,p[Maxn];
int T;
inline void Out(int x,int y){
if(x>lim) x=rt;if(y>lim) y=rt;
// if(n<=100) writepl(x),writeln(y);
writepl(x),writeln(y);
}
inline bool cmp(int a,int b){return limit[a].size()<limit[b].size();}
inline void work0(int x){
// if(T==38) cout<<x<<endl;
int l=x,r=x+1;
while(l!=r){
if(l==0) l+=m;if(r==m+1) r=1;
// cerr<<l<<' '<<r<<endl;
// cout<<l<<' '<<r<<endl;
Out(leaf[l],leaf[r]);
--l;++r;if(l==0) l+=m;if(r==m+1) r=1;
}Out(leaf[l],rt);
}
inline void work1(int x){
int l=x,r=x+1;
int lst=0;
while(l!=r){
if(l==0) l+=m;if(r==m+1) r=1;
--l;++r;if(l==0) l+=m;if(r==m+1) r=1;
}lst=l;l=x;r=x+1;
// cout<<"*"<<lst<<endl;
while(l!=r){
if(l==0) l+=m;if(r==m+1) r=1;
if(leaf[l]==limit[x].back().first){
Out(leaf[l],leaf[lst]);
}
Out(leaf[l],leaf[r]);
--l;++r;if(l==0) l+=m;if(r==m+1) r=1;
}
}
inline void work(){
idx=0;vector<pii> ().swap(ans);
n=read();m=0;clear();lim=n;
fr(i,1,n+1) vector<pii> ().swap(limit[i]);
fr(i,1,n-1){
int x,y;
x=read();y=read();
++d[x],++d[y];
vc[x].pb(y),vc[y].pb(x);
}
fr(i,1,n) if(d[i]==1) ++m;
if(m==2){
fr(i,1,n) if(d[i]==1) writepl(i);puts("");
fr(i,1,n) if(d[i]==1) writepl(i);puts("");
return;
}
fr(i,1,n) if(d[i]>2) rt=i;
// rt=1;
if(m%2==0){
// cout<<"*"<<rt<<' '<<n+1<<endl;
++n;vc[n].pb(rt);vc[rt].pb(n);
++d[rt],++d[n];++m;
}
dfs(rt,0);
// fr(i,1,n) if(d[i]==1) cout<<i<<' ';cout<<endl;
fr(i,1,idx) p[i]=i;
// fr(i,1,idx) cout<<leaf[i]<<' ';cout<<endl;
sort(p+1,p+idx+1,cmp);
// cout<<rt<<' '<<leaf[p[1]]<<' '<<limit[p[1]].size()<<endl;
// cerr<<limit[p[1]].size()<<endl;
assert(limit[p[1]].size()<=1);
// ++T;if(T==38){
// fr(i,1,n) if(d[i]>1) cout<<d[i]<<' ';cout<<endl;
// fr(i,1,n) for(auto p:vc[i]) if(d[i]>1 && d[p]>1 && i<p) cout<<d[i]<<' '<<d[p]<<endl;
// int S=0;fr(i,1,n) S+=d[i];
// cout<<n<<' '<<S<<endl;
// cout<<d[rt]<<endl;
// cout<<"**"<<limit[p[1]].size()<<' '<<m<<endl;
// }
if(limit[p[1]].size()==0) work0(p[1]);
else work1(p[1]);
}
inline void init(){
int t=read();
while(t--) work();
}
signed main(){
// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);
init();
// printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 16992kb
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:
2 3 1 4 5 1 1 4 1 4 3 4 5 2 3 5 1 6 4 4
result:
ok All OK (4 test cases)
Test #2:
score: 0
Accepted
time: 28ms
memory: 17200kb
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: 21ms
memory: 17008kb
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:
409 1202 1112 498 650 1233 1659 1575 961 1723 352 110 1589 1314 695 92 1257 826 1050 1608 1893 1403 902 617 158 1426 398 535 1803 95 1624 1612 833 545 1791 376 313 1752 1563 946 625 1531 1685 621 5 1574 1953 1703 775 1559 1207 339 765 719 1290 1203 1047 1925 1212 1882 84 1275 529 548 285 1547 1000 1...
result:
ok All OK (100 test cases)
Test #4:
score: 0
Accepted
time: 14ms
memory: 17040kb
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 140 1204 454 14...
result:
ok All OK (100 test cases)
Test #5:
score: 0
Accepted
time: 33ms
memory: 17180kb
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:
503 563 1425 781 639 1045 884 1971 1859 30 1311 477 484 446 755 178 389 1774 929 332 1978 734 1863 1823 1515 1143 501 1596 1470 955 1092 188 1115 1676 1472 1075 356 278 511 1590 1622 76 1739 1724 1037 1477 526 885 1384 305 1288 360 1324 1197 1586 347 1560 39 1510 630 1429 368 1460 1216 1689 1526 800...
result:
ok All OK (100 test cases)
Test #6:
score: 0
Accepted
time: 23ms
memory: 17816kb
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:
386 1432 207 824 367 1730 109 1674 1887 908 909 1114 609 1443 630 1444 438 988 4 1685 1261 592 1015 1491 1022 1046 1913 1592 1948 618 18 1637 467 845 1006 727 962 1235 644 726 1155 560 1619 1466 804 1363 402 1926 697 1224 373 887 1455 1961 1939 447 760 959 1904 524 780 1028 29 378 1537 472 544 1896 ...
result:
ok All OK (100 test cases)
Test #7:
score: 0
Accepted
time: 31ms
memory: 17048kb
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:
1788 1616 1328 1791 1457 1538 1548 1413 1451 1964 2000 1593 1777 1827 1783 1984 1140 1180 1458 1945 1830 1703 1371 1744 1468 1495 1709 1812 1454 1720 1512 1722 1903 1339 1368 1637 1606 1443 1212 1572 1230 1241 1825 1219 1630 1947 1914 1515 1968 1240 1822 1239 1621 1693 1873 1537 1736 1855 1519 1962 ...
result:
ok All OK (100 test cases)
Test #8:
score: 0
Accepted
time: 51ms
memory: 26596kb
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:
83676 5831 30381 56255 109210 124823 133391 185083 96253 31168 41803 37067 145814 3769 7670 81043 124145 181282 165902 18327 168607 56536 11448 128111 92002 141754 192065 132483 168210 109860 192482 95077 115611 35950 75983 39691 60634 63093 49211 63516 193849 2473 132317 139410 62908 18294 149444 1...
result:
ok All OK (1 test case)
Test #9:
score: 0
Accepted
time: 42ms
memory: 25156kb
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:
10226 176701 98186 5322 118952 158088 124762 151634 58708 56268 61980 144954 101528 150479 75283 181158 143760 65894 70282 170853 81006 67134 35936 71987 162513 79186 6162 95765 15594 132287 64856 150857 58639 129172 38189 172179 82421 30909 27769 32409 126499 56848 61724 89182 52563 167277 24040 15...
result:
ok All OK (1 test case)
Test #10:
score: 0
Accepted
time: 38ms
memory: 24320kb
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:
73833 37784 117295 63600 157478 55908 110438 94085 193950 143560 41698 10516 101786 125783 41199 68958 158445 138390 147987 72363 165524 169351 166964 32411 164580 109045 106161 109402 103876 187738 53791 153408 146555 79193 77397 103534 35434 175715 154393 194531 87818 54504 51791 124307 124765 616...
result:
ok All OK (1 test case)
Test #11:
score: 0
Accepted
time: 33ms
memory: 23440kb
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: 47ms
memory: 32556kb
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:
137124 120265 9315 146039 110169 101854 90200 96428 17770 180595 75014 127244 26370 16590 165281 151635 100127 27253 148374 10228 3259 50381 90936 43105 96796 69356 23928 55088 54805 111150 17574 128270 73525 97036 67917 148511 184459 63561 73150 115933 150180 157097 152565 124625 7208 147870 198989...
result:
ok All OK (1 test case)
Test #13:
score: 0
Accepted
time: 50ms
memory: 26044kb
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:
19395 193294 18767 170331 156541 190847 148332 134568 187101 162205 33838 121244 10328 73902 81952 21039 19449 91900 192342 8183 75106 88359 3608 163436 114137 178193 58145 188276 85864 131041 90868 171640 158288 76428 50511 151660 32058 6841 11711 100867 130595 72473 112940 21165 22655 55580 146719...
result:
ok All OK (1 test case)
Test #14:
score: 0
Accepted
time: 51ms
memory: 25392kb
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:
165200 193672 163749 131811 119666 164115 178317 124450 190907 190294 140238 148536 125671 157998 179706 116825 152500 136955 129791 193620 193687 127328 198804 114539 172390 184593 104635 95733 112792 100444 103381 150927 103659 95590 104775 131999 184089 146038 197911 105809 175344 199866 155702 1...
result:
ok All OK (1 test case)
Test #15:
score: 0
Accepted
time: 37ms
memory: 18036kb
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:
2035 18975 6528 4878 10660 5012 14260 1649 14522 15646 9412 7806 7437 13271 19781 19276 11466 5111 1 951 19291 16097 16478 3152 1862 19945 12603 4616 835 6428 10755 6390 5531 8643 15486 9048 5414 5100 3258 12389 17015 15270 5092 11457 19661 8144 12360 17220 13227 16667 18504 17354 10589 16376 17838 ...
result:
ok All OK (10 test cases)
Test #16:
score: 0
Accepted
time: 20ms
memory: 18188kb
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: 37ms
memory: 18960kb
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:
12094 15122 9930 11685 2594 16469 5603 13860 13645 15585 18136 1744 17436 13813 14722 10982 12124 18071 5266 18668 17116 936 17212 5869 7703 3784 5627 16359 16043 10462 16065 11342 15726 12964 941 5052 15839 11962 15802 13192 11378 56 609 5523 15941 12425 3898 15630 18268 12116 11494 2259 14426 214 ...
result:
ok All OK (10 test cases)
Test #18:
score: 0
Accepted
time: 36ms
memory: 18212kb
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:
19801 14314 16531 9978 7670 19866 12812 11474 7135 12688 6650 16352 10287 332 19189 11001 11455 5959 7467 9626 8100 18854 10369 14369 8818 1235 5088 14746 4046 8133 7638 19260 557 13123 8132 10579 2923 17175 9697 5276 13591 9227 14300 5836 14245 13403 8172 7547 17081 6 6964 15401 1574 16909 571 9433...
result:
ok All OK (10 test cases)
Test #19:
score: 0
Accepted
time: 39ms
memory: 18020kb
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:
17362 17391 15138 16668 19118 15541 18574 15977 18659 18054 17563 19075 16405 15094 17016 17351 16872 15386 17393 18211 16862 19042 19100 15299 19381 16696 15246 19980 18000 18388 19849 17994 17444 15395 17569 19111 17702 16847 16777 17858 19525 17840 18020 17402 15452 19982 19228 19034 15865 17932 ...
result:
ok All OK (10 test cases)
Test #20:
score: 0
Accepted
time: 28ms
memory: 18416kb
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:
10204 5749 9085 7660 9005 1018 9551 7034 9344 291 8874 5450 8194 5697 456 2634 4458 4787 5175 7436 10276 5692 10245 9350 6097 9452 904 5547 5344 1127 3754 9688 10495 3899 2315 1555 4058 1024 2994 7747 6916 9353 2980 7058 5436 10461 8235 7549 5842 4618 4088 4144 9228 6372 2007 7129 7391 10846 9481 31...
result:
ok All OK (10 test cases)
Test #21:
score: 0
Accepted
time: 23ms
memory: 17808kb
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:
9534 11845 4530 1158 13361 9325 6165 3967 5051 4991 2664 1043 8892 2335 2129 4488 12360 12940 9628 8652 3606 1198 3641 6151 11010 2353 6039 3349 5315 10122 6844 10051 2041 3552 1860 13158 1186 6848 9039 7170 7293 7152 6789 13130 4708 4423 1004 2453 3813 10767 13353 5551 1711 4541 484 3955 1022 5823 ...
result:
ok All OK (10 test cases)
Test #22:
score: 0
Accepted
time: 15ms
memory: 17572kb
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: 29ms
memory: 18472kb
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:
2304 3702 1181 3416 1124 3842 572 833 8287 12977 2150 8595 4102 10231 11793 7018 5601 4162 9132 4106 13324 9306 2582 1668 2064 2942 9578 13406 7037 8616 7588 10179 13456 5240 4370 1021 3169 5196 4065 10744 9099 12269 7151 13703 834 8306 3074 2130 2657 3512 3345 12926 5834 11350 6623 819 11691 9077 1...
result:
ok All OK (10 test cases)
Test #24:
score: 0
Accepted
time: 26ms
memory: 18004kb
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:
4189 6617 8444 36 4037 3191 7536 10329 7911 4143 10637 12247 5224 10111 8435 5994 11117 8198 3098 5092 4816 1429 1616 11840 14482 13285 10852 6054 2283 87 3259 6483 12405 2919 9350 11776 5643 5979 1240 4244 9972 1252 9656 10475 13259 10818 9346 6850 10898 10686 48 3208 7251 4805 9005 7851 2495 4072 ...
result:
ok All OK (10 test cases)
Test #25:
score: 0
Accepted
time: 22ms
memory: 17996kb
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:
13737 14771 14266 13831 13401 13674 13783 13999 12691 13824 13368 13046 13230 14459 14335 14633 12997 13026 12797 14020 13726 14198 12739 13809 14308 12984 12963 14034 14634 14121 12991 12922 13151 14201 14233 14724 13692 13074 13273 14210 12858 13882 12662 12915 14691 14482 14323 13688 14729 12852 ...
result:
ok All OK (10 test cases)
Test #26:
score: 0
Accepted
time: 24ms
memory: 17960kb
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:
16931 16726 17082 16654 16938 16516 17156 17130 16344 17002 16972 17210 16604 16248 16829 16216 16668 17228 17462 16237 16316 17307 16843 16349 16826 16845 16742 16374 17370 16988 17310 17425 17347 16290 16594 16474 17196 16609 16471 17477 17083 16888 17184 17386 16763 16798 17457 17048 16743 16637 ...
result:
ok All OK (10 test cases)
Test #27:
score: 0
Accepted
time: 31ms
memory: 17832kb
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:
19888 18835 19637 19515 19720 19370 19611 19486 18834 19365 19619 19916 19953 19086 19356 19589 19850 18794 19060 19647 18745 19740 18945 19592 19405 19746 18911 19870 19352 19183 19843 18934 18927 19765 19759 19168 19379 18845 18749 19811 19105 19011 19040 19527 19594 19525 19446 19654 19421 19506 ...
result:
ok All OK (10 test cases)
Test #28:
score: 0
Accepted
time: 31ms
memory: 17888kb
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:
19901 11166 13664 2623 13825 14669 5845 4162 5450 17634 13642 15732 16516 5947 9070 8345 7469 8945 17507 15276 12184 3832 10720 8729 15791 19472 3625 10205 14351 13580 11915 19663 15227 5114 7693 17214 14540 16959 6833 6718 1866 4935 19933 2841 11831 8329 6210 9314 18390 5348 19669 18908 15812 3295 ...
result:
ok All OK (10 test cases)
Test #29:
score: 0
Accepted
time: 23ms
memory: 17088kb
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:
1051 870 1137 603 1134 1501 1763 134 1323 1800 1080 717 963 1246 868 299 271 1490 1926 967 169 340 1754 242 1451 1844 467 639 1638 205 944 1091 1260 1001 192 1890 683 1825 1791 1495 854 430 143 1944 1752 1761 432 705 1569 1936 1485 165 1985 1595 386 1570 1450 220 1301 101 610 104 1594 1947 1694 934 ...
result:
ok All OK (100 test cases)
Test #30:
score: 0
Accepted
time: 28ms
memory: 17100kb
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:
1998 1999 1990 1987 1985 1994 1978 1983 2000 1986 1988 1984 1995 1993 1992 1980 1979 1996 1997 1981 1991 1989 1982 1959 1915 1967 1972 1961 1921 1959 1942 1939 1965 1916 2000 1989 1979 1948 1970 1946 1924 1918 1975 1956 1962 1982 1999 1981 1980 1977 1993 1951 1952 1936 1920 1985 1925 1966 1973 1943 ...
result:
ok All OK (100 test cases)
Test #31:
score: 0
Accepted
time: 39ms
memory: 25368kb
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:
128228 77526 49551 153825 112302 179529 39421 173343 11806 127297 105043 159544 156108 5412 118165 19414 175805 191066 145154 47667 110946 160099 88217 86189 118987 59050 33505 121001 162030 113010 85669 182716 93798 163224 70348 60000 161015 169361 183124 84375 146778 94194 102762 15871 119029 7046...
result:
ok All OK (1 test case)
Test #32:
score: 0
Accepted
time: 45ms
memory: 30508kb
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 179729
result:
ok All OK (1 test case)
Test #33:
score: 0
Accepted
time: 43ms
memory: 24912kb
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:
199883 199212 199456 199264 199706 199388 199307 199861 199635 199870 199555 199987 199242 199127 199958 199400 199209 199434 199168 199697 199332 199764 199155 199659 199489 199334 199962 199727 199981 199328 199761 199986 199124 199857 199928 199709 199529 199650 199911 199362 199850 199108 199869...
result:
ok All OK (1 test case)