QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#287242 | #3506. Team Contest | DaiRuiChen007 | 100 ✓ | 78ms | 10156kb | C++20 | 779b | 2023-12-20 08:00:59 | 2023-12-20 08:01:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1.5e5+5;
int a[MAXN],b[MAXN],c[MAXN];
bool vis[MAXN];
priority_queue <array<int,2>> A,B,C;
signed main() {
int n;
scanf("%d",&n);
for(int i=1;i<=n;++i) {
scanf("%d%d%d",&a[i],&b[i],&c[i]);
A.push({a[i],i}),B.push({b[i],i}),C.push({c[i],i});
}
while(A.size()&&B.size()&&C.size()) {
int x=A.top()[1],y=B.top()[1],z=C.top()[1];
if(b[x]==b[y]||c[x]==c[z]) vis[x]=true;
if(a[y]==a[x]||c[y]==c[z]) vis[y]=true;
if(a[z]==a[x]||b[z]==b[y]) vis[z]=true;
if(!vis[x]&&!vis[y]&&!vis[z]) return printf("%d\n",a[x]+b[y]+c[z]),0;
while(A.size()&&vis[A.top()[1]]) A.pop();
while(B.size()&&vis[B.top()[1]]) B.pop();
while(C.size()&&vis[C.top()[1]]) C.pop();
}
puts("-1");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 0ms
memory: 3884kb
input:
3 1 1 2 1 2 1 2 1 1
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
3 1 2 2 2 1 2 2 2 1
output:
-1
result:
ok single line: '-1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 3 3 3 2 2 2 1 1 1
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
4 3 1 1 2 2 2 1 1 3 1 2 1
output:
8
result:
ok single line: '8'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
3 1 2 3 1 3 4 1 4 2
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
3 4 1 3 3 1 2 2 1 4
output:
-1
result:
ok single line: '-1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
3 2 4 1 4 3 1 3 2 1
output:
-1
result:
ok single line: '-1'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
3 9 9 1 9 9 2 9 9 3
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
3 9 2 9 9 3 9 9 1 9
output:
-1
result:
ok single line: '-1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
3 3 9 9 1 9 9 2 9 9
output:
-1
result:
ok single line: '-1'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
300 57761889 84542255 27050597 34660889 31001456 73541706 28145521 16239284 59747407 28301910 73147643 52729219 76934759 81682223 25122810 79313872 51831684 8459494 79291107 42746492 28469171 178085 36381730 88571483 88031596 68636497 47738858 78328954 72492907 81005026 20116327 27194915 29047676 15...
output:
298779499
result:
ok single line: '298779499'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
236 11541369 9792582 4713403 87402689 82538784 88522804 35622147 10769145 14518449 85768984 12580765 86992032 97843742 97233030 66564513 87402689 41237008 87442884 73770719 95022375 94286048 89771996 85187794 89890546 61271783 67426819 70494968 638822 67263206 68519784 53640982 58599424 55894005 414...
output:
116772345
result:
ok single line: '116772345'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
269 58136345 49561853 5443232 82513448 84993754 23134893 22936917 4757404 58572392 55675309 81607644 84281385 77118458 79792604 84221560 95665801 97753268 96965456 75900766 78524832 80967453 88062625 87328036 70262153 69366513 49346229 29658819 22352552 10391396 40033635 22375771 60866395 3431631 61...
output:
219417965
result:
ok single line: '219417965'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
300 8161981 27071802 32031373 8819234 23356530 24538586 10553392 11086093 9901019 2335958 33351071 36363483 4517467 7763984 8075958 5311696 5749790 6698515 90417492 2769387 90241112 61926281 51651765 54285034 996697 517518 2853812 61926281 51651765 44079327 78933588 9905743 78435105 5171396 24886452...
output:
-1
result:
ok single line: '-1'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
280 133 127 23 85 28 108 67 68 115 121 90 100 89 17 102 82 115 58 116 136 77 160 178 93 137 25 116 44 110 68 20 54 48 119 102 117 131 69 8 56 71 133 84 1 66 123 63 26 14 12 116 108 46 80 18 27 59 40 18 85 86 103 86 9 294 295 45 48 21 75 98 43 84 110 67 258 251 92 97 122 81 22 8 36 12 133 129 21 47 1...
output:
424
result:
ok single line: '424'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
300 29 36 16 22 13 41 10 60 40 27 25 47 41 58 12 91 108 114 40 11 26 28 39 51 62 79 69 34 44 1 6 23 32 43 2 22 43 28 28 15 47 29 16 44 39 41 2 13 3 11 3 26 25 2 33 23 8 4 2 13 29 50 49 35 114 123 10 59 47 29 40 40 36 62 4 19 50 2 9 4 43 25 31 35 22 39 30 13 15 47 9 33 40 107 107 60 43 54 51 43 12 26...
output:
159
result:
ok single line: '159'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
297 16 15 18 1 20 20 11 16 7 18 20 8 17 20 13 18 17 19 11 12 13 17 16 7 5 20 19 6 18 19 12 14 18 11 8 18 12 16 4 11 14 7 13 11 18 3 20 20 6 16 17 4 12 14 12 16 9 16 14 18 17 19 18 12 2 18 1 15 16 3 20 20 15 16 16 10 16 18 7 12 15 17 1 19 11 18 19 8 16 18 11 14 14 11 2 17 16 19 19 11 10 15 7 20 19 16...
output:
-1
result:
ok single line: '-1'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
294 97782065 49441237 40553674 9802414 49441237 40811934 97782065 49441237 5522754 97782065 2894174 40811934 16244848 49441237 40811934 97782065 9535463 40811934 97782065 42126153 40811934 97782065 49441237 40811934 97782065 49441237 26799076 97782065 49441237 35044643 97782065 49441237 3672688 7878...
output:
-1
result:
ok single line: '-1'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
285 35578202 31000569 36164852 81961944 76527075 82527820 88051400 86477050 89247199 94640648 92434215 94445703 94995965 93531084 95877794 89327002 87766145 90029250 92910262 91636154 93379830 2426096 3925994 6056288 35633423 31247563 36205265 15437571 12960237 21719331 76640285 69178877 77008765 39...
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
300 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451 97002072 78259156 57267451...
output:
-1
result:
ok single line: '-1'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
298 1 1 1 2 1 1 2 2 1 2 2 2 2 2 3 2 3 3 2 4 3 2 4 4 2 4 5 3 4 5 3 4 6 3 5 6 4 5 6 5 5 6 5 6 6 6 6 6 6 6 7 6 7 7 6 7 8 6 8 8 6 8 9 7 8 9 7 9 9 8 9 9 8 9 10 8 9 11 8 9 12 9 9 12 10 9 12 10 9 13 10 9 14 11 9 14 12 9 14 12 9 15 13 9 15 13 9 16 13 10 16 14 10 16 14 10 17 14 10 18 15 10 18 16 10 18 16 10 ...
output:
300
result:
ok single line: '300'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
298 2 2 2 2 3 2 2 3 3 3 3 3 3 4 3 4 4 3 5 4 3 5 5 3 6 5 3 7 5 3 7 5 4 8 5 4 8 6 4 8 7 4 9 7 4 10 7 4 11 7 4 11 8 4 12 8 4 13 8 4 13 8 5 13 9 5 13 10 5 13 11 5 13 11 6 13 11 7 13 12 7 13 13 7 13 13 8 14 13 8 14 13 9 15 13 9 15 14 9 15 15 9 15 15 10 16 15 10 16 15 11 16 16 11 16 17 11 16 18 11 16 18 1...
output:
6
result:
ok single line: '6'
Subtask #2:
score: 29
Accepted
Dependency #1:
100%
Accepted
Test #23:
score: 29
Accepted
time: 0ms
memory: 4080kb
input:
4000 69754624 40719054 25880627 45203696 74886668 48113236 40895239 84354151 84890376 580122 37101650 40004403 59771964 89650621 34494619 79179033 28652564 80985199 779920 79517242 92970610 20761904 89259959 69731542 65839528 15069115 60213981 5488382 94474806 56098782 90286260 33217627 87863760 862...
output:
299859551
result:
ok single line: '299859551'
Test #24:
score: 0
Accepted
time: 1ms
memory: 4116kb
input:
3976 73080835 73640233 17173988 38377905 54150225 29777426 22029226 17439133 72850346 61386107 40478181 4651975 16895999 51353691 43033018 57768480 23567989 60837577 61998151 26423316 14211198 51429621 26067062 75369957 29953695 1177407 26929816 27206543 15665697 52877584 20574799 48632736 58521973 ...
output:
260736782
result:
ok single line: '260736782'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3932kb
input:
3999 99927690 82478783 99894018 52462308 24076588 3853388 49684627 86270167 86956767 80151792 80384937 29911028 86472898 90557517 90991905 64083294 6483865 46599362 49160914 45527295 9784891 72907827 73209811 33536143 24783914 18011564 7818799 5695363 21346535 27147968 43452998 45734019 52114612 916...
output:
214455382
result:
ok single line: '214455382'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
3983 46849863 43395352 44177592 45657330 42981464 43171279 20939599 73900639 73101781 65057736 62457563 35356299 90533889 9436603 90283376 88644998 68106794 87666543 64635325 61721461 22520753 34122184 4775910 32524643 15121582 15343649 3341666 1623242 1912753 1243989 371131 459445 121013 62142487 5...
output:
-1
result:
ok single line: '-1'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
2669 1203 722 409 1256 1277 44 1914 1956 896 189 1258 1224 2033 2056 2069 2128 1129 2153 1270 1431 1390 1938 1977 1717 1426 1100 1439 971 1799 1811 1076 437 1 1785 424 1847 1442 1486 898 693 1166 523 614 1942 1961 967 1251 1218 1303 485 1307 935 1634 1631 1263 1287 1227 646 379 2 1809 1863 886 90 15...
output:
3670
result:
ok single line: '3670'
Test #28:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
3999 218 755 664 1366 474 1371 92 171 572 402 109 682 801 13 831 307 390 666 745 504 462 1408 920 1397 364 325 780 233 465 599 374 52 436 374 139 165 496 624 91 240 504 151 35 618 229 739 523 358 311 449 388 71 688 806 485 433 93 653 189 39 180 163 703 377 117 755 75 69 208 675 174 495 108 932 972 1...
output:
2433
result:
ok single line: '2433'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
4000 234 42 243 88 272 269 249 247 133 122 229 237 219 211 113 215 99 209 201 114 202 202 178 202 34 265 265 270 275 163 288 105 279 249 247 19 276 277 12 253 69 259 243 242 95 112 201 203 262 267 134 239 236 154 155 275 270 215 25 210 266 93 266 254 65 261 289 294 287 249 118 257 288 48 278 275 275...
output:
-1
result:
ok single line: '-1'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3804kb
input:
3827 58082543 57688628 42141064 58082543 37790572 56085417 30971155 57688628 56085417 58082543 7542303 56085417 58082543 6153647 56085417 58082543 57688628 56085417 58082543 57688628 56085417 58082543 15627876 56085417 19305094 57688628 56085417 58082543 57688628 56085417 51215057 57688628 56085417 ...
output:
-1
result:
ok single line: '-1'
Test #31:
score: 0
Accepted
time: 2ms
memory: 3988kb
input:
3994 22717165 23485128 24150090 58326041 59735236 60460260 99683380 99624257 99659578 32760370 34440574 34542189 15816729 16596399 16849315 10007699 10765273 11243538 36933127 38871347 38984815 84796877 86029328 86457916 90312082 90579793 91410302 24270836 24773451 25474600 81299206 82908771 8295564...
output:
-1
result:
ok single line: '-1'
Test #32:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
898 1 1 1 2 1 1 2 2 1 3 2 1 3 3 1 3 3 2 3 3 3 4 3 3 5 3 3 6 3 3 6 3 4 7 3 4 8 3 4 8 3 5 8 3 6 8 3 7 8 3 8 8 3 9 8 3 10 9 3 10 9 3 11 9 4 11 9 5 11 9 6 11 9 7 11 9 7 12 10 7 12 10 7 13 11 7 13 11 7 14 11 8 14 11 9 14 12 9 14 12 10 14 12 11 14 12 12 14 12 12 15 13 12 15 14 12 15 15 12 15 15 12 16 15 1...
output:
900
result:
ok single line: '900'
Test #33:
score: 0
Accepted
time: 1ms
memory: 3952kb
input:
898 2 2 2 2 2 3 2 2 4 2 3 4 2 3 5 2 3 6 3 3 6 4 3 6 5 3 6 5 3 7 5 4 7 6 4 7 7 4 7 8 4 7 8 5 7 9 5 7 9 5 8 9 5 9 9 5 10 10 5 10 10 6 10 11 6 10 12 6 10 12 6 11 12 6 12 12 7 12 13 7 12 14 7 12 15 7 12 15 8 12 15 8 13 16 8 13 16 9 13 16 10 13 16 11 13 16 11 14 16 12 14 16 13 14 17 13 14 18 13 14 19 13 ...
output:
6
result:
ok single line: '6'
Test #34:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
4000 1 1 1 2 1 1 2 2 1 2 3 1 3 3 1 3 4 1 4 4 1 4 4 2 4 4 3 4 5 3 5 5 3 5 6 3 5 6 4 5 7 4 5 8 4 6 8 4 6 8 5 6 9 5 6 9 6 7 9 6 7 9 7 7 9 8 7 10 8 8 10 8 8 10 9 8 10 10 9 10 10 9 11 10 9 11 11 9 11 12 9 12 12 9 12 13 10 12 13 11 12 13 11 13 13 11 14 13 12 14 13 12 15 13 12 16 13 12 16 14 12 16 15 13 16...
output:
4002
result:
ok single line: '4002'
Test #35:
score: 0
Accepted
time: 2ms
memory: 4052kb
input:
4000 2 2 2 3 2 2 3 2 3 4 2 3 4 3 3 4 3 4 5 3 4 5 4 4 5 5 4 5 5 5 5 6 5 5 6 6 6 6 6 6 6 7 7 6 7 8 6 7 8 6 8 9 6 8 10 6 8 11 6 8 12 6 8 12 7 8 12 7 9 12 7 10 12 8 10 12 8 11 12 9 11 12 9 12 12 9 13 13 9 13 13 9 14 14 9 14 14 9 15 14 9 16 14 9 17 15 9 17 16 9 17 17 9 17 18 9 17 18 9 18 18 9 19 18 9 20 ...
output:
6
result:
ok single line: '6'
Subtask #3:
score: 9
Accepted
Test #36:
score: 9
Accepted
time: 26ms
memory: 8916kb
input:
150000 3 3 1 2 5 5 1 3 5 4 3 5 3 4 4 4 4 2 4 3 5 5 1 2 5 4 1 2 3 3 4 4 5 3 3 5 2 4 3 1 3 2 5 2 4 4 5 3 2 5 1 5 4 3 3 2 5 1 1 4 3 2 5 2 3 5 3 3 4 1 3 4 2 4 3 1 5 4 2 1 4 1 4 4 5 4 3 4 5 3 2 1 2 5 4 5 4 5 4 5 1 2 1 4 1 3 1 4 2 5 2 3 5 3 3 4 2 5 1 4 5 2 1 1 2 2 1 3 2 5 4 3 5 4 5 3 2 4 5 5 2 5 3 3 3 4 4...
output:
15
result:
ok single line: '15'
Test #37:
score: 0
Accepted
time: 35ms
memory: 7144kb
input:
99999 1 1 2 2 4 1 2 4 5 3 4 5 1 5 5 4 2 5 1 1 2 2 4 2 2 4 4 3 4 2 4 4 5 2 4 4 1 2 2 1 1 2 1 2 1 1 5 5 1 1 1 5 3 5 2 4 1 1 4 4 2 5 5 1 1 2 3 4 4 2 4 2 4 2 5 3 3 4 1 2 2 4 5 3 3 4 2 4 5 3 2 4 5 1 1 1 3 4 4 2 4 1 1 1 1 3 5 5 3 4 1 2 4 2 3 4 5 1 2 2 1 2 1 4 4 4 1 1 1 2 1 4 1 4 5 3 5 5 2 4 5 3 4 5 3 3 4 ...
output:
8
result:
ok single line: '8'
Test #38:
score: 0
Accepted
time: 20ms
memory: 7952kb
input:
123456 1 1 1 1 1 1 3 3 1 3 1 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 3 3 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 3 3 2 1 1 1 1 1 1 1 1 3 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 5 3 3 2 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 5 4 2 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1...
output:
7
result:
ok single line: '7'
Test #39:
score: 0
Accepted
time: 60ms
memory: 9028kb
input:
149999 2 3 4 5 2 5 1 5 5 4 4 5 5 2 4 5 2 4 2 4 5 5 5 4 4 2 4 3 5 5 4 4 2 5 1 4 3 2 4 5 2 5 5 4 1 3 3 1 3 1 4 5 2 5 1 2 4 3 1 4 1 5 5 3 4 4 3 4 5 1 2 4 4 1 4 1 2 4 3 3 3 3 3 3 3 4 4 3 4 4 3 3 3 5 2 5 5 3 5 4 2 4 3 3 4 5 4 4 5 4 5 4 4 1 3 2 3 1 2 4 4 1 4 5 5 1 3 2 2 3 1 4 5 3 5 5 4 1 4 4 1 2 4 4 5 4 2...
output:
-1
result:
ok single line: '-1'
Test #40:
score: 0
Accepted
time: 56ms
memory: 8952kb
input:
150000 2 4 3 2 4 2 2 4 2 2 2 5 1 4 5 1 4 5 2 4 5 2 4 5 2 4 3 1 4 5 2 4 5 2 1 5 1 4 5 2 4 4 2 4 5 2 1 5 1 4 5 2 3 5 2 2 5 2 4 4 2 3 5 1 4 5 2 3 5 2 4 5 1 4 5 1 4 5 1 4 5 2 4 4 1 4 5 1 4 5 1 4 5 1 4 5 2 4 1 1 4 5 1 4 5 2 4 3 2 2 5 2 4 5 1 4 5 2 3 5 1 4 5 2 2 5 2 4 5 2 1 5 2 4 5 2 4 4 2 1 5 1 4 5 2 4 5...
output:
-1
result:
ok single line: '-1'
Test #41:
score: 0
Accepted
time: 43ms
memory: 8888kb
input:
150000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
-1
result:
ok single line: '-1'
Subtask #4:
score: 9
Accepted
Dependency #3:
100%
Accepted
Test #42:
score: 9
Accepted
time: 1ms
memory: 3992kb
input:
2000 13 12 20 6 1 11 17 1 9 5 19 14 5 12 15 14 20 17 18 16 2 13 11 18 9 12 2 10 15 1 9 8 3 4 12 8 6 9 3 4 16 8 8 13 13 10 20 14 15 13 17 4 2 1 8 3 16 7 8 9 15 20 10 8 17 6 1 13 16 5 18 1 5 9 17 19 19 11 10 11 4 3 5 14 6 13 11 15 5 10 8 2 16 16 2 10 16 12 14 15 6 9 17 20 16 7 4 7 17 12 3 18 18 20 12 ...
output:
60
result:
ok single line: '60'
Test #43:
score: 0
Accepted
time: 31ms
memory: 8952kb
input:
150000 15 14 20 19 11 19 12 8 5 8 18 20 14 5 7 12 2 11 3 10 12 12 20 2 18 5 17 8 14 20 3 1 11 17 17 7 5 7 18 14 2 14 17 19 4 12 19 7 12 8 5 1 7 18 12 20 1 5 4 1 11 15 3 2 17 1 4 5 7 3 5 16 20 1 18 8 9 1 2 17 13 2 4 1 13 12 10 12 15 12 12 14 20 11 2 7 16 10 15 13 18 14 3 17 17 1 18 17 3 2 4 3 2 14 6 ...
output:
60
result:
ok single line: '60'
Test #44:
score: 0
Accepted
time: 32ms
memory: 8800kb
input:
146357 4 4 5 2 7 5 8 6 3 1 6 5 8 1 1 2 7 7 11 3 12 5 5 7 5 6 2 6 2 4 5 8 7 14 18 20 8 6 5 2 1 7 19 18 10 1 8 2 1 6 2 17 16 19 7 7 8 7 1 8 4 6 8 8 15 18 2 8 1 3 4 8 8 1 3 16 19 20 4 5 1 6 2 6 16 17 10 3 3 7 5 3 3 2 3 3 2 13 15 8 5 3 3 5 4 6 7 7 7 2 1 6 4 7 7 4 5 8 1 8 12 1 14 8 7 4 4 1 1 2 4 4 16 3 1...
output:
27
result:
ok single line: '27'
Test #45:
score: 0
Accepted
time: 41ms
memory: 7352kb
input:
108561 14 13 9 3 5 5 14 8 16 12 1 12 5 3 7 1 4 6 3 12 14 10 6 10 11 5 11 2 10 10 14 9 15 7 14 16 8 3 9 13 7 13 14 11 2 14 10 16 4 13 16 12 10 2 9 17 18 13 10 1 7 10 12 1 4 7 3 4 4 7 2 4 2 2 6 15 14 9 9 4 9 7 4 7 1 2 3 17 17 10 3 7 9 13 4 12 10 3 10 4 2 1 12 10 13 2 1 2 13 10 2 18 18 4 3 2 6 16 16 9 ...
output:
22
result:
ok single line: '22'
Test #46:
score: 0
Accepted
time: 72ms
memory: 8920kb
input:
149670 3 19 19 10 14 2 9 9 9 13 17 7 17 18 10 4 18 15 10 11 9 7 8 8 19 9 19 3 11 9 16 17 17 6 9 6 20 20 4 13 16 5 13 14 9 7 11 2 20 2 19 13 16 3 20 1 19 20 12 19 15 18 13 5 17 14 6 12 9 13 3 10 15 18 10 7 15 9 12 17 14 2 10 8 8 5 9 2 15 9 14 18 17 12 15 9 4 18 19 10 7 9 8 17 10 13 2 12 10 14 4 3 14 ...
output:
-1
result:
ok single line: '-1'
Test #47:
score: 0
Accepted
time: 59ms
memory: 8804kb
input:
149992 4 12 3 2 12 6 1 12 6 4 12 1 4 7 6 4 12 2 4 10 6 4 12 6 4 12 2 4 12 6 4 12 2 4 12 1 4 5 6 4 12 5 4 1 6 4 12 2 4 12 4 4 12 6 1 12 6 1 12 6 4 12 6 4 2 6 4 12 6 4 12 6 4 11 6 4 9 6 4 9 6 4 12 5 4 5 6 4 12 6 2 12 6 4 12 6 4 12 4 4 12 1 4 4 6 3 12 6 3 12 6 4 12 6 4 12 2 4 5 6 4 12 5 4 12 6 4 12 6 1...
output:
-1
result:
ok single line: '-1'
Subtask #5:
score: 9
Accepted
Dependency #4:
100%
Accepted
Test #48:
score: 9
Accepted
time: 25ms
memory: 8920kb
input:
142857 68 39 191 69 19 83 255 92 215 13 119 166 298 33 23 113 269 103 133 115 148 146 287 209 123 2 189 63 159 178 239 180 127 73 231 212 242 197 179 212 186 291 41 197 274 298 82 172 69 147 298 218 52 257 162 77 274 206 109 217 290 300 131 272 227 145 161 11 283 276 83 256 77 240 36 3 79 189 222 3 ...
output:
900
result:
ok single line: '900'
Test #49:
score: 0
Accepted
time: 39ms
memory: 9092kb
input:
135792 6 12 24 89 61 15 4 150 128 244 86 228 150 8 116 184 157 116 8 101 9 55 98 19 142 220 209 24 69 113 126 133 126 95 20 99 264 146 255 258 284 282 222 290 285 118 282 279 139 103 124 147 60 95 154 148 103 51 129 118 202 100 189 141 71 15 38 246 235 145 43 31 48 135 141 139 78 39 289 289 78 10 15...
output:
550
result:
ok single line: '550'
Test #50:
score: 0
Accepted
time: 44ms
memory: 9036kb
input:
150000 12 66 60 60 65 116 31 65 31 48 104 127 287 218 282 160 173 120 56 146 27 96 109 123 138 102 21 288 288 149 46 14 32 62 69 108 59 129 32 75 86 64 63 151 21 120 72 75 225 257 259 4 16 96 12 117 68 54 208 179 82 78 40 60 76 42 14 167 136 46 63 76 137 21 60 67 31 77 219 218 117 50 115 39 139 141 ...
output:
441
result:
ok single line: '441'
Test #51:
score: 0
Accepted
time: 77ms
memory: 9044kb
input:
148610 52 183 169 113 300 297 156 190 181 247 246 248 212 2 222 218 56 224 239 190 242 203 223 98 173 220 216 163 194 75 234 261 246 202 187 216 227 243 124 27 271 266 183 205 97 215 165 222 216 233 209 158 190 140 247 79 247 225 94 229 170 200 109 195 214 25 180 35 194 184 206 81 252 268 31 48 197 ...
output:
-1
result:
ok single line: '-1'
Test #52:
score: 0
Accepted
time: 53ms
memory: 9044kb
input:
146573 289 145 57 289 237 35 289 181 57 289 47 57 289 212 57 289 237 57 289 237 8 289 33 57 289 237 44 289 237 42 289 184 57 182 237 57 289 237 44 289 95 57 289 93 57 289 164 57 289 237 57 289 68 57 289 237 41 88 237 57 289 237 53 289 237 19 289 21 57 114 237 57 289 108 57 289 150 57 289 127 57 289 ...
output:
-1
result:
ok single line: '-1'
Test #53:
score: 0
Accepted
time: 37ms
memory: 6516kb
input:
90000 300 1 1 300 1 2 300 1 3 300 1 4 300 1 5 300 1 6 300 1 7 300 1 8 300 1 9 300 1 10 300 1 11 300 1 12 300 1 13 300 1 14 300 1 15 300 1 16 300 1 17 300 1 18 300 1 19 300 1 20 300 1 21 300 1 22 300 1 23 300 1 24 300 1 25 300 1 26 300 1 27 300 1 28 300 1 29 300 1 30 300 1 31 300 1 32 300 1 33 300 1 ...
output:
-1
result:
ok single line: '-1'
Subtask #6:
score: 9
Accepted
Dependency #5:
100%
Accepted
Test #54:
score: 9
Accepted
time: 31ms
memory: 9060kb
input:
149996 3691 1395 3862 2765 3538 3498 128 964 337 3450 3294 2440 889 1498 3948 3770 898 1144 690 3900 643 730 738 162 1403 2635 885 3176 2916 3274 3734 2476 3312 2364 3574 319 2984 2748 1599 341 1349 3576 3040 423 2932 3050 3639 3437 184 48 3489 3660 2148 1115 2171 7 1939 2415 854 461 1900 3796 507 1...
output:
12000
result:
ok single line: '12000'
Test #55:
score: 0
Accepted
time: 72ms
memory: 9068kb
input:
149997 1936 2010 380 3368 416 3333 641 2952 2917 2112 716 2179 2970 36 2973 812 3153 3113 2697 622 2720 1973 2180 2184 3313 332 3281 2450 2068 2499 2923 2319 2929 24 2860 2847 2608 3284 3260 2523 2582 46 2875 1094 2885 2065 2131 772 3467 3464 3230 3591 3574 2358 3301 1963 3273 2521 1147 2559 883 131...
output:
5821
result:
ok single line: '5821'
Test #56:
score: 0
Accepted
time: 60ms
memory: 8968kb
input:
149998 3571 938 3570 1617 1498 188 3297 3326 3234 500 2240 2259 3826 1939 3834 1609 2711 2707 1652 166 887 3110 3127 785 468 875 1368 1335 169 1339 3091 3109 1004 1611 1128 501 2624 812 2629 1326 1557 388 3411 81 3431 1475 3739 3740 418 1454 219 2610 1833 2612 2064 2425 2428 382 377 894 2888 2915 12...
output:
5023
result:
ok single line: '5023'
Test #57:
score: 0
Accepted
time: 70ms
memory: 9096kb
input:
149999 2268 296 2248 1992 2039 864 1253 3939 3910 896 2165 2093 1073 2421 2348 2527 2514 2498 1974 2025 833 2570 2615 2545 3856 6 3847 2014 510 2000 3220 724 3192 2768 2120 2723 2037 2088 633 3469 3461 3438 1945 2782 2719 2315 2368 618 2773 2789 470 3741 2137 3750 3480 3477 2394 2454 1586 2421 2316 ...
output:
-1
result:
ok single line: '-1'
Test #58:
score: 0
Accepted
time: 55ms
memory: 8948kb
input:
150000 548 2153 2082 548 3611 2082 129 3611 2082 548 3611 697 548 2258 2082 548 1871 2082 548 3611 1203 548 3611 1747 548 3611 386 548 3611 2082 497 3611 2082 548 3611 2082 502 3611 2082 548 2944 2082 317 3611 2082 548 3611 769 548 2007 2082 90 3611 2082 548 1476 2082 548 1202 2082 548 3611 2082 548...
output:
-1
result:
ok single line: '-1'
Subtask #7:
score: 27
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #59:
score: 27
Accepted
time: 28ms
memory: 9940kb
input:
150000 40354668 12525897 68689619 29737194 65479937 5935300 13400822 48054701 83880045 9918783 32801661 23792076 16751303 1922440 81936195 33449970 98070319 59848058 24258191 87425028 65452814 13692425 62912178 89784413 73609489 21413877 99869060 88356366 14332677 55098375 83670483 53539954 73121066...
output:
299998147
result:
ok single line: '299998147'
Test #60:
score: 0
Accepted
time: 61ms
memory: 8908kb
input:
150000 9677619 53196615 21360909 94288227 94478938 10449574 84395770 84504367 73211055 68735340 68818788 68739856 95178367 3878563 95072418 5628547 7693749 37484683 39744876 46158350 27321810 67298360 67335055 67284480 77888135 77836810 77960405 57796924 89743263 89631026 64480465 64382797 46394875 ...
output:
173147724
result:
ok single line: '173147724'
Test #61:
score: 0
Accepted
time: 41ms
memory: 8892kb
input:
150000 27371475 31117308 10792860 97897409 97877604 21783836 70284503 19682663 35541375 67681290 27627311 22015370 18348319 30861869 82205666 76215861 4695422 61453201 57940325 83270065 20948916 38531308 99615389 99640641 21569409 54575849 69351587 64860728 74574028 58754131 43714683 67760536 490207...
output:
286761573
result:
ok single line: '286761573'
Test #62:
score: 0
Accepted
time: 76ms
memory: 8920kb
input:
150000 22789335 22680865 17576712 58458294 57745749 58343035 3806433 17319708 17483484 19033163 20712150 21095278 97378158 85399432 97377937 99572 1145018 1184206 18397816 15865021 18755907 39158681 38970366 30165398 10383687 10302611 10880378 72205140 71628454 72245004 25986781 8657845 26117592 634...
output:
-1
result:
ok single line: '-1'
Test #63:
score: 0
Accepted
time: 47ms
memory: 9048kb
input:
150000 11838 13298 15774 2688 13183 12694 18585 6179 18794 26683 26875 13640 5223 16722 7068 22218 8787 22367 9656 1123 12512 615 28778 28779 4930 888 9199 13740 16575 15447 14281 15283 11552 13863 6501 14828 3589 15025 8878 3834 1955 9336 17790 11326 29 4738 14578 11539 26968 13384 27083 13648 9506...
output:
55125
result:
ok single line: '55125'
Test #64:
score: 0
Accepted
time: 63ms
memory: 9096kb
input:
150000 44454 118448 118115 124664 137635 137526 104795 104750 37428 4379 53710 618 117050 50528 116753 145977 27151 145958 5134 19639 918 138942 26580 138676 53512 17366 57699 135563 135324 62426 84236 22096 83980 79325 76270 79201 133452 95860 133121 25520 7178 29236 147344 147266 37212 104672 1247...
output:
213504
result:
ok single line: '213504'
Test #65:
score: 0
Accepted
time: 78ms
memory: 8916kb
input:
150000 55905 32573 55937 60692 60751 28781 44277 47673 47480 42635 34046 42587 67992 52785 68075 45758 38664 45777 54721 68815 68917 44685 27300 44715 36337 43890 43719 54123 46507 54280 56180 56295 29971 37177 6912 37178 37427 45341 45156 44477 14309 44484 48138 41577 48184 50972 56673 56604 40743 ...
output:
-1
result:
ok single line: '-1'
Test #66:
score: 0
Accepted
time: 59ms
memory: 10156kb
input:
150000 10999486 2074802 96680107 52440104 593929 96680107 42100903 2074802 96680107 52440104 2074802 2481850 33392220 2074802 96680107 52440104 1700897 96680107 52440104 2074802 12505813 52440104 2074802 89649790 3476881 2074802 96680107 52440104 1513443 96680107 52440104 2074802 64864950 52440104 2...
output:
-1
result:
ok single line: '-1'
Test #67:
score: 0
Accepted
time: 52ms
memory: 9044kb
input:
150000 47407365 47853850 47583499 44777846 45083602 44935662 31380210 31598368 31515286 27757693 28036585 27889335 35407393 35710126 35610131 27846617 28116090 27968455 58672825 59212618 59064984 223122 254856 250859 48428006 48804616 48621968 87165558 87325507 87338506 97892651 97963083 97945520 54...
output:
-1
result:
ok single line: '-1'
Test #68:
score: 0
Accepted
time: 46ms
memory: 8908kb
input:
150000 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962824 39307702 48391937 80962...
output:
-1
result:
ok single line: '-1'
Test #69:
score: 0
Accepted
time: 34ms
memory: 8904kb
input:
149998 1 1 1 1 2 1 1 2 2 1 3 2 1 3 3 1 3 4 1 3 5 1 4 5 1 4 6 1 5 6 1 6 6 2 6 6 3 6 6 3 6 7 4 6 7 4 6 8 4 7 8 4 7 9 4 8 9 4 8 10 5 8 10 5 9 10 5 9 11 6 9 11 7 9 11 8 9 11 8 10 11 8 11 11 9 11 11 9 12 11 10 12 11 11 12 11 11 12 12 12 12 12 13 12 12 13 13 12 13 14 12 14 14 12 14 15 12 14 15 13 14 16 13...
output:
150000
result:
ok single line: '150000'
Test #70:
score: 0
Accepted
time: 61ms
memory: 8924kb
input:
149998 2 2 2 2 3 2 2 4 2 2 4 3 2 5 3 2 5 4 2 5 5 3 5 5 3 5 6 3 6 6 3 6 7 4 6 7 5 6 7 6 6 7 6 7 7 6 8 7 6 8 8 6 8 9 6 8 10 6 9 10 6 9 11 7 9 11 7 10 11 7 11 11 8 11 11 8 11 12 9 11 12 9 11 13 9 12 13 10 12 13 10 12 14 10 12 15 11 12 15 11 12 16 11 12 17 12 12 17 12 13 17 12 13 18 12 14 18 13 14 18 13...
output:
6
result:
ok single line: '6'
Extra Test:
score: 0
Extra Test Passed