QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#292647 | #1295. Fastest Speedrun | snow_trace | AC ✓ | 379ms | 200100kb | C++14 | 2.8kb | 2023-12-28 10:20:40 | 2023-12-28 10:20:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2505;
int c[N][N],mn_cycle[N][N],mnpos[N][N];vector<int>cycle[N];int cc[N][N];
vector<int>p[N],p1[N];
int t[N];
int dis[N];int n;
int col[N],vis[N],ok[N];int nw;vector<int>s;
void dfs1(int now){
col[now] = nw;
for(int i =0;i<p[now].size();i++)if(!col[p[now][i]])dfs1(p[now][i]);
}void dfs2(int now,int c,int id){
if(vis[now] == id){
while(s.back()!=now){
cycle[c].push_back(s.back());s.pop_back();
}cycle[c].push_back(now);s.pop_back();
// cout << now << endl;
// for(int x:cycle[c])cout << x << " ";cout << endl;
return;
}vis[now] = id;s.push_back(now);
for(int i =0;i<p1[now].size();i++){
//cout<< ' '<<p1[now][i] << " " << vis[p1[now][i]] << endl;
if(!vis[p1[now][i]] or vis[p1[now][i]]==id)dfs2(p1[now][i],c,id);
}if(s.size())s.pop_back();
return;
}void dfs3(int now,int fa){
//cout<< ' '<<now<< ' '<<fa<<endl;
for(int i= 0;i<=n;i++)cc[now][i] = min(cc[now][i],cc[fa][i]);
for(int i = 0;i<p1[now].size();i++){
if(ok[p1[now][i]] == 0)dfs3(p1[now][i],now);
}
return;
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n;vector<int>pp;
for(int i = 1;i<=n;i++){
int x;cin >> x;p1[x].push_back(i);p[x].push_back(i);p[i].push_back(x);
cin >> t[i];//pp.push_back(x);
for(int j = 0;j<=n;j++)cin >> c[i][j];
}for(int i =0;i<=n;i++){
if(!col[i]){
nw++;dfs1(i);
}
}for(int i =0;i<=n;i++){
if(!vis[i]){
dfs2(i,col[i],i+1);s.clear();
}
}for(int i = 1;i<=n;i++)for(int j =0;j<=n;j++)cc[i][j] = c[i][j]-t[i];
int res = 0;
for(int i =1;i<=nw;i++){
for(int j = 0;j<=n;j++){
int mn = 2000000005,pos = 0,mn1= 2000000005;;
for(int x:cycle[i]){
// cout << x << " ";
if(c[x][j]<mn)mn = c[x][j],pos = x;mn1 = min(mn1,c[x][j]-t[x]);
}if(i == 1)pos = mn =mn1= 0;
mn_cycle[i][j] = mn1;mnpos[i][j] = pos;if(j == n)res+=mn1;
//cout << endl;
}
}for(int i = 1;i<=nw;i++){
for(int x:cycle[i])ok[x]=1;
}for(int i = 1;i<=nw;i++){
for(int x:cycle[i])dfs3(x,x);
}
for(int i = 1;i<=n;i++)res+=t[i];
//for(int i = 1;i<=nw;i++)res+=(mn_cycle[i][n]-t[mnpos[i][n]]);
//cout << res << endl;
for(int i =0;i<=n;i++)dis[i] = 1e18;dis[0] = 0;
for(int i = 1;i<=n;i++){
for(int j =0;j<i;j++){
int cost = min(mn_cycle[col[i]][j]-mn_cycle[col[i]][n],cc[i][j]);
dis[i] = min(dis[i],dis[j]+cost);
}
}int ans = res+dis[n];
cout << ans << endl;
return 0;
}
// 经典套路:连边以后是一颗外向基环树,在环里选一个点买下来就能全部跳过激活。
// 然后我们假设最大值一开始就是 n,考虑答案与其差的最小值
// 本质上是我们需要求一个最短路也就是最少多花费多少以后最大的选的点就变成 n
// 激活一个点,两种方式:激活环,激活树上父亲
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 9968kb
input:
1 1 46655 801493 606509
output:
801493
result:
ok single line: '801493'
Test #2:
score: 0
Accepted
time: 0ms
memory: 9848kb
input:
2 0 30959 840157 382961 250706 2 73638 750573 497639 377934
output:
528598
result:
ok single line: '528598'
Test #3:
score: 0
Accepted
time: 0ms
memory: 9836kb
input:
3 0 70473 73268 72749 71642 71006 3 67615 69789 68595 67615 67615 1 84421 87580 86225 85864 84856
output:
222509
result:
ok single line: '222509'
Test #4:
score: 0
Accepted
time: 1ms
memory: 9820kb
input:
5 4 36983 880873 542403 447855 310109 309120 289166 1 2573 758485 525354 524133 517284 430873 171522 4 49956 741491 612741 566137 402069 396666 241786 5 65511 904417 741480 615115 539173 294813 236885 2 48676 922325 870948 453391 375291 328714 268288
output:
959611
result:
ok single line: '959611'
Test #5:
score: 0
Accepted
time: 0ms
memory: 15828kb
input:
10 8 73343 860150 839235 822724 821373 638663 593660 572760 491466 485375 258547 150021 9 9556 847952 819225 785472 662051 595729 566426 541364 454369 356846 236212 136029 0 2380 827000 584529 547699 482964 455015 448063 416973 327715 263254 81443 55243 8 95810 879235 875497 854558 716249 481134 469...
output:
636684
result:
ok single line: '636684'
Test #6:
score: 0
Accepted
time: 1ms
memory: 9908kb
input:
10 6 59834 921756 640795 635654 612984 542500 436518 342887 271826 221615 129388 63231 6 58985 821959 752681 712339 707545 662700 649466 532250 400709 278832 175367 174881 4 83588 926028 915496 892254 878746 388992 358414 332074 329060 183331 131380 125892 10 59032 645556 639858 585525 238505 234457...
output:
1409055
result:
ok single line: '1409055'
Test #7:
score: 0
Accepted
time: 11ms
memory: 51240kb
input:
498 0 60615 928378 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 722954 7...
output:
24969576
result:
ok single line: '24969576'
Test #8:
score: 0
Accepted
time: 13ms
memory: 49420kb
input:
499 2 21743 23225 22494 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 21743 ...
output:
24831336
result:
ok single line: '24831336'
Test #9:
score: 0
Accepted
time: 11ms
memory: 45516kb
input:
500 2 2766 849636 711800 271179 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 84448 8444...
output:
24403084
result:
ok single line: '24403084'
Test #10:
score: 0
Accepted
time: 11ms
memory: 50880kb
input:
500 4 40074 41421 40558 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 40074 ...
output:
26096328
result:
ok single line: '26096328'
Test #11:
score: 0
Accepted
time: 12ms
memory: 51060kb
input:
498 3 82124 390347 390164 389461 388180 386706 386679 385062 385043 383617 383402 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 381992 3...
output:
24833044
result:
ok single line: '24833044'
Test #12:
score: 0
Accepted
time: 0ms
memory: 10096kb
input:
40 3 55910 998732523 993081070 989052309 986540828 983516822 981879326 979756331 979637791 978839342 973603470 969379007 968551703 966344320 964315059 959263415 957754446 957158610 952963553 949449433 946113606 944722747 941425892 936442203 933253663 931865086 928699312 927465165 925907287 925272489...
output:
2714678703
result:
ok single line: '2714678703'
Test #13:
score: 0
Accepted
time: 3ms
memory: 14224kb
input:
100 15 61044 999121407 997064835 995964647 995887658 994895373 993341522 992188121 990851552 990634237 990153672 988974405 988895435 988200232 987003492 984853709 982859426 981810504 981095209 980939783 980836877 978602730 977538621 974432590 973926227 972651903 971221617 970917466 967441799 9670792...
output:
3707676322
result:
ok single line: '3707676322'
Test #14:
score: 0
Accepted
time: 14ms
memory: 30316kb
input:
400 345 51777 999992344 999342000 999335523 999186494 998511958 998364428 998328441 998320310 998042189 997258154 997162302 996950457 996778404 996395118 996322831 996314346 994707204 994266086 994211811 994041553 993704720 993277373 993148996 992850377 992723191 992631731 992375821 992065702 991263...
output:
5517650034
result:
ok single line: '5517650034'
Test #15:
score: 0
Accepted
time: 373ms
memory: 155036kb
input:
2500 790 50841 999992773 999915236 999837971 999830586 999782245 999780452 999767511 999713193 999689328 999674982 999653970 999627586 999617281 999542671 999521622 999510074 999508821 999467460 999426058 999387383 999366580 999300335 999244132 999216570 999188626 999165652 999122871 999112438 99910...
output:
1117074007996
result:
ok single line: '1117074007996'
Test #16:
score: 0
Accepted
time: 295ms
memory: 163236kb
input:
2500 2486 24456 914426 914243 913872 913853 913244 913113 913056 912881 912785 912444 911836 911806 910132 909967 909512 909314 908886 908437 908203 907381 906916 906110 906085 904490 904479 904246 904076 903593 903301 901926 901871 901647 901042 900926 900645 900382 899487 899293 898775 898341 8981...
output:
125142117
result:
ok single line: '125142117'
Test #17:
score: 0
Accepted
time: 303ms
memory: 183628kb
input:
2500 1 53691 943187 943032 942984 942870 941950 941730 941057 940755 940556 940491 940192 940173 940002 939983 939938 939581 939479 939218 939003 938920 938908 938857 938690 937841 937740 937488 937360 937167 937129 937049 936804 936217 936145 935728 935381 934981 934942 934431 934024 933155 933151 ...
output:
124717434
result:
ok single line: '124717434'
Test #18:
score: 0
Accepted
time: 379ms
memory: 200100kb
input:
2500 1 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000...
output:
2500000000000
result:
ok single line: '2500000000000'
Test #19:
score: 0
Accepted
time: 4ms
memory: 50788kb
input:
500 1 73941 960975 959909 958424 956652 949826 949544 945525 942981 942326 941094 940197 938870 937963 937276 937126 933038 931776 931225 931121 929996 929724 929490 929467 925189 922907 921827 919491 916713 915548 913629 913142 912534 911464 910287 910061 908713 907545 904861 903848 903147 899570 8...
output:
26864007
result:
ok single line: '26864007'
Test #20:
score: 0
Accepted
time: 7ms
memory: 51260kb
input:
500 1 79603 380943 380235 379340 378869 378660 377127 376938 375720 374801 373794 373086 372144 371750 370855 370025 369389 368617 367846 367171 366543 365238 364939 363105 362519 361917 360541 359859 359669 358961 358190 356916 356565 355492 355056 354274 353857 352273 351332 350742 350084 348850 3...
output:
81472835
result:
ok single line: '81472835'
Test #21:
score: 0
Accepted
time: 4ms
memory: 37300kb
input:
500 0 74374 75679 74477 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 74374 ...
output:
47747568
result:
ok single line: '47747568'
Test #22:
score: 0
Accepted
time: 12ms
memory: 30824kb
input:
500 0 64776 515531 514050 513848 512833 512296 511006 510596 509146 509055 508298 507267 505901 505105 505099 503660 503059 501978 501107 500745 499883 498974 498356 497107 496777 495852 495544 494026 493146 492928 491761 491465 490761 489816 488669 488187 486915 486120 485899 484324 484198 483166 4...
output:
25445904
result:
ok single line: '25445904'
Test #23:
score: 0
Accepted
time: 12ms
memory: 30332kb
input:
500 0 26046 912364 911365 910975 908604 908575 905154 905017 904603 904533 900450 899971 899722 892458 891505 889708 888761 886578 883751 877388 875247 874967 873476 872936 872541 870555 869177 867387 867359 864605 860159 859711 858869 857562 857281 857126 856927 855313 850593 848685 847123 843379 8...
output:
24219887
result:
ok single line: '24219887'
Test #24:
score: 0
Accepted
time: 12ms
memory: 34528kb
input:
500 0 77840 78545 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 77840 ...
output:
40240507
result:
ok single line: '40240507'
Test #25:
score: 0
Accepted
time: 39ms
memory: 55860kb
input:
1000 0 32810 33889 33371 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810 32810...
output:
64063374
result:
ok single line: '64063374'
Test #26:
score: 0
Accepted
time: 8ms
memory: 30772kb
input:
500 322 60764 949852 945270 942171 942128 940438 939760 939690 939043 938596 937268 936850 934927 933010 932946 932520 932205 930781 930224 928887 927803 927729 922873 912108 910922 909796 906538 904936 903178 902023 897235 896172 895463 895447 892875 892792 888517 886761 880414 877309 875900 872742...
output:
25267218
result:
ok single line: '25267218'
Test #27:
score: 0
Accepted
time: 10ms
memory: 30592kb
input:
500 224 49055 50439 49421 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 49055 4905...
output:
25585407
result:
ok single line: '25585407'
Test #28:
score: 0
Accepted
time: 17ms
memory: 30984kb
input:
500 100 58160 808190 807538 807203 805980 805434 804760 803417 802788 802698 801624 800467 799871 798089 797727 796852 796289 794927 794811 793551 793074 792259 791602 790653 789076 788460 788289 787461 786776 785846 784602 784199 783127 782347 781851 780503 780449 779101 777925 777574 777372 775918...
output:
26626458
result:
ok single line: '26626458'
Test #29:
score: 0
Accepted
time: 16ms
memory: 30580kb
input:
500 323 54950 804308 803637 802943 802495 801517 800404 799054 798936 797092 796625 795851 795493 795366 793342 792886 792081 791812 790494 789575 789190 788290 786896 786503 785718 784656 784160 782615 782529 782182 780580 780425 779980 777827 777569 777028 776068 775846 774801 773709 772996 772194...
output:
26395378
result:
ok single line: '26395378'
Test #30:
score: 0
Accepted
time: 50ms
memory: 67636kb
input:
1000 345 19246 516816 516076 515117 514516 513388 512857 512310 511424 510473 510002 509223 508178 507291 506559 505546 504742 503888 502792 502040 501301 501217 499711 498885 498130 498028 496391 495912 495479 494488 493244 492483 491732 490930 489971 489522 488676 488158 486843 486770 485197 48499...
output:
90955319
result:
ok single line: '90955319'
Test #31:
score: 0
Accepted
time: 197ms
memory: 129348kb
input:
2000 873 45245 934517 934068 933994 933319 933180 932975 932289 931618 931546 931446 931371 931267 930792 930167 928856 928273 927608 927271 927172 925873 925406 924952 924566 921902 921727 921548 920823 920616 920614 920556 920319 919887 919215 919030 918520 918499 918478 918329 917260 917099 91644...
output:
104317515
result:
ok single line: '104317515'
Test #32:
score: 0
Accepted
time: 280ms
memory: 122252kb
input:
2500 2 57960 59045 58419 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960 57960...
output:
139191756
result:
ok single line: '139191756'
Test #33:
score: 0
Accepted
time: 308ms
memory: 105788kb
input:
2500 839 92660 1576091 1575326 1574079 1573094 1573042 1571479 1570770 1570366 1569719 1568925 1567855 1566980 1566587 1565117 1564498 1564083 1562949 1561833 1561434 1560411 1559799 1558710 1558142 1557375 1556557 1555391 1554910 1554204 1553566 1552463 1551632 1550626 1550171 1549260 1548732 15477...
output:
125062634
result:
ok single line: '125062634'
Test #34:
score: 0
Accepted
time: 339ms
memory: 106048kb
input:
2500 777 25713 2377087 2375881 2374784 2374707 2373445 2372225 2371137 2370409 2369817 2369259 2368759 2367746 2366565 2365863 2365486 2364588 2364009 2363470 2361587 2361137 2360751 2359552 2358694 2358664 2356849 2356650 2355706 2355522 2353590 2352954 2352930 2352187 2350889 2349366 2348643 23485...
output:
126764224
result:
ok single line: '126764224'
Test #35:
score: 0
Accepted
time: 0ms
memory: 9948kb
input:
10 9 64590 935052 899973 792210 734283 451960 428955 380926 376858 349034 290802 255599 6 60215 943032 792752 754452 673990 596634 456332 403480 332671 245076 188702 144899 3 11984 858119 790598 727433 647393 576076 557267 239823 234651 103943 92238 16224 5 58026 934140 906537 838140 788818 715719 5...
output:
1375165
result:
ok single line: '1375165'
Test #36:
score: 0
Accepted
time: 0ms
memory: 10000kb
input:
10 8 48535 884504 881145 664291 610479 589317 556155 533862 427856 381607 166572 78572 2 35894 876041 858306 625276 541403 448881 359436 331494 298389 124739 115298 61354 5 61166 919778 890393 865386 753245 673793 571831 556964 469446 375278 116879 114807 7 14736 768406 753563 744294 724153 613774 5...
output:
699759
result:
ok single line: '699759'
Test #37:
score: 0
Accepted
time: 1ms
memory: 9844kb
input:
10 8 8243 852809 840408 752952 550242 529488 410806 353874 348206 305433 156422 111964 3 25930 909043 843569 827650 621162 411245 252970 228332 179785 74087 57559 38971 2 95249 825933 797710 579965 579683 545989 509968 481272 374066 287824 143090 134197 8 22905 765596 666812 525646 499503 497959 447...
output:
1412740
result:
ok single line: '1412740'
Test #38:
score: 0
Accepted
time: 0ms
memory: 17980kb
input:
20 17 94838 979459 968033 923889 838609 833883 795823 721253 684118 658813 592963 579382 458986 402690 359989 335207 295259 280643 251664 210621 209417 193371 16 88377 970447 961875 953012 910616 828371 822803 802158 779640 733281 699562 626711 528700 445027 396188 364532 336432 248336 185474 167938...
output:
1983219
result:
ok single line: '1983219'
Test #39:
score: 0
Accepted
time: 0ms
memory: 9992kb
input:
20 1 51675 931849 885946 819029 758705 749016 711594 711271 656434 585646 585447 506851 482272 466988 421775 408818 361498 300942 270288 221267 81787 54674 17 18081 883959 789000 787452 786076 772403 682449 635046 487021 470720 420300 412205 410191 409514 389090 379433 270199 233744 233155 184976 90...
output:
2013956
result:
ok single line: '2013956'
Test #40:
score: 0
Accepted
time: 0ms
memory: 17984kb
input:
40 1 53368 923195 912567 892318 844297 811138 803633 783835 765450 760075 746175 732407 727601 712331 697505 689574 686428 624844 546431 534238 531653 529829 517183 506011 503544 487283 487044 467816 412209 393239 386102 344704 328655 326256 297560 262385 251974 185134 171428 122476 98812 95461 35 9...
output:
2471113
result:
ok single line: '2471113'
Test #41:
score: 0
Accepted
time: 2ms
memory: 12100kb
input:
40 9 74539 961911 951254 900994 900110 891879 887490 867480 865987 858013 827144 767511 748390 745188 744796 734660 709880 702551 685425 672143 659759 627687 597309 575442 544572 532565 481672 470493 430864 421173 381228 372066 361970 257686 244841 220468 141673 129723 116087 106497 89913 85509 37 9...
output:
3039592
result:
ok single line: '3039592'
Test #42:
score: 0
Accepted
time: 1ms
memory: 9988kb
input:
40 36 57839 934372 931154 928235 927209 884317 881551 865239 861568 811337 792929 784106 765350 706009 701682 618003 613613 587495 581916 570086 566462 559155 526016 507611 494962 433411 382663 366392 352733 343345 342377 335794 332401 313597 308564 283104 248818 214998 152380 94284 72314 59507 21 3...
output:
3123138
result:
ok single line: '3123138'
Test #43:
score: 0
Accepted
time: 0ms
memory: 18648kb
input:
200 30 80843 970631 965959 962837 962321 962306 957486 956937 955985 951819 940015 931966 918884 916450 907176 903794 902949 898982 893222 885800 880566 879884 878624 876320 875173 870178 858137 855878 851763 851555 843642 838473 835436 830293 829233 824081 810513 800035 791178 791149 781505 776277 ...
output:
10529746
result:
ok single line: '10529746'
Test #44:
score: 0
Accepted
time: 4ms
memory: 18660kb
input:
200 26 73580 962448 961631 957392 957190 956398 956063 955286 953930 951781 950212 939637 930837 929781 929048 925188 915299 914378 912724 911740 909525 903496 902414 899433 898727 894885 887262 882375 848349 833566 820711 817698 816299 813316 813003 810125 784855 768972 765852 757799 753243 749145 ...
output:
11359596
result:
ok single line: '11359596'
Test #45:
score: 0
Accepted
time: 0ms
memory: 22308kb
input:
200 66 93084 975939 970651 963552 952385 944121 941468 935156 934498 934311 934256 929088 928895 927660 927046 925739 919443 909499 904600 903494 902877 900751 889497 873871 866123 860023 855888 844295 841078 839296 828992 827280 818519 814746 813078 812870 811943 810617 806813 801825 796150 791110 ...
output:
11284903
result:
ok single line: '11284903'
Test #46:
score: 0
Accepted
time: 1ms
memory: 9924kb
input:
6 2 1 6 6 6 3 2 1 1 3 1 7 6 6 4 2 1 1 6 1 5 5 3 2 2 1 1 4 1 6 6 3 2 2 1 1 5 1 6 6 3 2 2 1 1 1 1 7 6 6 5 2 1 1
output:
10
result:
ok single line: '10'
Test #47:
score: 0
Accepted
time: 0ms
memory: 22036kb
input:
250 28 230455 997861081 995307820 991793928 991259075 988642596 988025394 987520900 987514123 977483061 970799223 967990615 964773721 952321168 948221015 948144692 947763724 945186431 944874285 941577878 941035419 931742870 930839095 927370865 925649465 920406073 912813439 907873306 906763824 904173...
output:
1102767415
result:
ok single line: '1102767415'