QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#727353 | #1291. Brexit Negotiations | TheZone | AC ✓ | 200ms | 46212kb | C++14 | 3.3kb | 2024-11-09 12:54:37 | 2024-11-09 12:54:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 4e5+100;
int c[maxn];
vector<int> E[maxn];
vector<int> e[maxn];
int n;
int rd[maxn];
int RD[maxn];
vector<int> top_order;
int R[maxn];
void init_top_order(){
queue<int> Q;
for (int i=1;i<=n;i++){
if (rd[i] == 0){
Q.push(i);
}
}
while (!Q.empty()){
int head = Q.front();
Q.pop();
top_order.push_back(head);
for (int v : E[head]){
rd[v] --;
if (rd[v] == 0){
Q.push(v);
}
}
}
}
struct Node{
int x;
bool operator <(const Node&other)const{
return c[other.x] > c[x];
}
};
int check(){
for (int i = top_order.size() - 1;i >=0;i--){
int x = top_order[i];
for (int v : E[x]){
c[x] = max(c[x],c[v]);
}
}
for (int i=1;i<=n;i++){
rd[i] = RD[i];
}
priority_queue<Node> pq;
for (int i=1;i<=n;i++){
if (rd[i] == 0){
pq.push((Node){i});
}
}
int now = 0;
int ans = 0;
while (!pq.empty()){
int head = pq.top().x;
ans = max(ans,now + c[head]);
now ++;
pq.pop();
for (int v : E[head]){
rd[v] --;
if (rd[v] == 0){
pq.push((Node){v});
}
}
}
return ans;
}
int main(){
scanf("%d",&n);
int max_c = -0x3f3f3f3f;
for (int i=1;i<=n;i++){
int cnt;
scanf("%d%d",&c[i],&cnt);
max_c = max(max_c,c[i]);
for (int j=0;j<cnt;j++){
int y;
scanf("%d",&y);
E[y].push_back(i);
rd[i] ++;
RD[i] ++;
}
}
init_top_order();
cout<<check()<<endl;
return 0;
}
/*#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 4e5+100;
int c[maxn];
vector<int> E[maxn];
vector<int> e[maxn];
int n;
int rd[maxn];
int RD[maxn];
vector<int> top_order;
int R[maxn];
void init_top_order(){
queue<int> Q;
for (int i=1;i<=n;i++){
if (rd[i] == 0){
Q.push(i);
}
}
while (!Q.empty()){
int head = Q.front();
Q.pop();
top_order.push_back(head);
for (int v : E[head]){
rd[v] --;
if (rd[v] == 0){
Q.push(v);
}
}
}
}
struct Node{
int x;
bool operator <(const Node&other)const{
return c[other.x] > c[x];
}
};
int check(){
for (int i = top_order.size() - 1;i >=0;i--){
int x = top_order[i];
for (int v : E[x]){
c[x] = max(c[x],c[v]);
}
}
for (int i=1;i<=n;i++){
rd[i] = RD[i];
}
priority_queue<Node> pq;
for (int i=1;i<=n;i++){
if (rd[i] == 0){
pq.push((Node){i});
}
}
int now = 0;
int ans = 0;
while (!pq.empty()){
int head = pq.top().x;
ans = max(ans,now + c[head]);
now ++;
pq.pop();
for (int v : E[head]){
rd[v] --;
if (rd[v] == 0){
pq.push((Node){v});
}
}
init_top_order();
cout<<check()<<endl;
return 0;
}*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 28236kb
input:
5 7 0 3 0 11 0 9 0 2 4 4 2 3 1
output:
11
result:
ok single line: '11'
Test #2:
score: 0
Accepted
time: 0ms
memory: 26264kb
input:
12 3 1 2 5 1 3 7 1 4 11 0 7 1 6 3 1 7 5 1 8 11 0 11 1 10 3 1 11 7 1 12 5 0
output:
16
result:
ok single line: '16'
Test #3:
score: 0
Accepted
time: 0ms
memory: 26440kb
input:
7 42 1 7 23 1 7 666 1 7 4711 1 7 11 1 7 32 1 7 1 0
output:
4712
result:
ok single line: '4712'
Test #4:
score: 0
Accepted
time: 5ms
memory: 26192kb
input:
7 11 0 12 0 13 0 17 3 3 2 1 9 1 4 7 1 4 5 1 4
output:
20
result:
ok single line: '20'
Test #5:
score: 0
Accepted
time: 0ms
memory: 26132kb
input:
7 9 1 7 17 1 7 8 1 7 3 1 7 5 1 7 12 5 2 4 3 1 5 7 0
output:
18
result:
ok single line: '18'
Test #6:
score: 0
Accepted
time: 0ms
memory: 26480kb
input:
10 7 3 2 9 8 9 1 3 5 1 4 11 2 5 10 13 1 6 7 1 7 17 1 8 23 0 1 1 7 42 1 8
output:
43
result:
ok single line: '43'
Test #7:
score: 0
Accepted
time: 0ms
memory: 26452kb
input:
10 11 2 10 5 17 3 6 7 9 7 2 6 9 1 4 8 9 10 6 23 2 7 8 45 0 42 0 43 0 46 0 44 0
output:
46
result:
ok single line: '46'
Test #8:
score: 0
Accepted
time: 3ms
memory: 26164kb
input:
10 42 0 23 1 1 37 1 1 7 2 2 3 9 2 3 2 13 2 2 3 13 2 3 2 42 4 5 6 7 4 99 4 6 7 4 5 1 2 8 9
output:
106
result:
ok single line: '106'
Test #9:
score: 0
Accepted
time: 0ms
memory: 24464kb
input:
1 23 0
output:
23
result:
ok single line: '23'
Test #10:
score: 0
Accepted
time: 0ms
memory: 28304kb
input:
6 4713 2 6 4 4712 0 4715 1 6 4717 0 4714 0 4717 0
output:
4718
result:
ok single line: '4718'
Test #11:
score: 0
Accepted
time: 0ms
memory: 26124kb
input:
5 4 0 10 0 8 0 2 2 2 3 6 1 2
output:
10
result:
ok single line: '10'
Test #12:
score: 0
Accepted
time: 0ms
memory: 26128kb
input:
17 4722 1 8 4727 0 4721 1 2 4719 0 4713 0 4725 0 4715 2 2 6 4726 1 12 4724 2 2 12 4716 2 12 11 4723 0 4728 0 4714 1 1 4713 2 3 9 4720 2 6 12 4718 2 9 8 4717 0
output:
4729
result:
ok single line: '4729'
Test #13:
score: 0
Accepted
time: 0ms
memory: 26632kb
input:
11 22 0 2 2 4 10 8 3 11 8 6 6 1 1 4 2 7 4 10 2 9 10 20 0 16 2 10 7 14 0 18 0 12 2 7 9
output:
22
result:
ok single line: '22'
Test #14:
score: 0
Accepted
time: 0ms
memory: 26188kb
input:
3 4712 1 3 4713 1 3 4715 0
output:
4715
result:
ok single line: '4715'
Test #15:
score: 0
Accepted
time: 5ms
memory: 26448kb
input:
18 4715 3 16 7 14 4728 1 6 4727 1 6 4716 3 8 17 14 4726 2 3 2 4729 0 4719 2 3 12 4724 2 13 2 4713 1 6 4719 3 17 5 7 4712 2 9 2 4721 1 6 4725 1 6 4717 2 13 12 4714 4 18 1 4 10 4723 2 3 13 4720 2 2 12 4722 3 8 16 5
output:
4730
result:
ok single line: '4730'
Test #16:
score: 0
Accepted
time: 5ms
memory: 26668kb
input:
11 12 2 7 3 6 0 14 0 16 2 8 7 22 0 2 1 2 20 0 18 0 10 2 3 8 4 0 8 1 4
output:
22
result:
ok single line: '22'
Test #17:
score: 0
Accepted
time: 0ms
memory: 28184kb
input:
15 4712 0 4717 0 4723 0 4715 1 13 4726 0 4718 0 4716 1 10 4713 0 4722 0 4720 1 14 4714 0 4726 0 4721 0 4724 0 4719 2 10 5
output:
4727
result:
ok single line: '4727'
Test #18:
score: 0
Accepted
time: 0ms
memory: 26164kb
input:
19 34 1 18 22 2 6 18 2 2 1 2 14 2 18 17 8 0 32 0 30 2 9 18 18 2 1 7 36 0 20 0 16 0 12 2 6 9 6 2 7 14 24 1 9 26 1 1 4 0 28 0 38 0 10 1 15
output:
38
result:
ok single line: '38'
Test #19:
score: 0
Accepted
time: 0ms
memory: 28528kb
input:
9 122668 0 227592 2 7 1 386762 0 759098 1 8 286957 1 7 773230 0 897774 0 490247 1 1 459066 2 1 6
output:
897774
result:
ok single line: '897774'
Test #20:
score: 0
Accepted
time: 3ms
memory: 26356kb
input:
10 1 0 14 1 1 18 1 1 17 0 12 0 1 1 1 7 3 1 4 5 9 1 7 7 0 17 2 6 8
output:
24
result:
ok single line: '24'
Test #21:
score: 0
Accepted
time: 0ms
memory: 26276kb
input:
100 4 0 20 0 11 1 1 4 1 1 18 0 14 1 5 10 1 1 16 1 5 17 1 5 13 4 1 2 4 8 12 1 7 19 5 3 5 7 8 10 2 2 3 9 9 2 2 12 9 3 4 5 14 13 3 4 13 15 12 5 1 3 5 6 16 14 5 2 4 8 9 13 20 2 6 10 7 6 1 6 12 15 17 19 11 3 2 3 17 12 5 5 7 10 12 18 9 4 11 14 16 20 3 7 2 3 5 6 10 12 13 20 6 10 12 13 16 17 21 10 5 5 11 13...
output:
112
result:
ok single line: '112'
Test #22:
score: 0
Accepted
time: 8ms
memory: 27232kb
input:
1000 5152 0 50 0 979 0 5078 0 2167 1 2 3007 0 5009 1 1 1000 3 2 4 7 8109 1 3 9479 3 2 4 5 2444 0 1753 5 1 4 5 6 9 6322 2 9 10 8731 2 8 12 9852 3 3 5 10 3362 4 4 6 9 14 8958 3 1 5 10 9238 3 2 3 5 3053 7 1 3 6 7 9 10 11 609 3 4 9 19 6934 5 5 8 14 17 18 6717 8 1 2 7 10 12 13 15 18 5389 3 6 13 20 3851 7...
output:
10818
result:
ok single line: '10818'
Test #23:
score: 0
Accepted
time: 0ms
memory: 26200kb
input:
1000 3577 0 9575 0 8466 0 5221 0 7299 0 4485 0 4229 0 8181 0 6860 0 3242 0 1860 0 6445 0 8110 0 8621 0 4724 0 7035 0 1460 0 3313 0 5675 0 2129 0 1283 0 405 0 1279 0 4989 0 5286 0 6684 0 7245 0 7660 0 238 0 2295 0 6324 0 421 0 1710 0 8280 0 5000 0 5800 0 8178 0 6313 0 8000 0 6799 0 9340 0 8941 0 4211...
output:
9990
result:
ok single line: '9990'
Test #24:
score: 0
Accepted
time: 6ms
memory: 26672kb
input:
1000 4720 0 3518 1 1 4732 1 2 8593 1 3 8466 1 4 7404 1 5 9941 1 6 6821 1 7 919 1 8 3662 1 9 997 1 10 7965 1 11 1767 1 12 1897 1 13 9855 1 14 5231 1 15 9737 1 16 5177 1 17 7346 1 18 943 1 19 7674 1 20 20 1 21 4177 1 22 1208 1 23 3543 1 24 6397 1 25 6582 1 26 7022 1 27 8706 1 28 6279 1 29 2867 1 30 68...
output:
10852
result:
ok single line: '10852'
Test #25:
score: 0
Accepted
time: 2ms
memory: 26256kb
input:
1024 6762 0 925 1 1 2691 1 1 590 2 3 2 768 1 1 1360 2 5 2 5263 2 5 3 2476 3 7 6 4 5611 1 1 1984 2 9 2 622 2 9 3 8899 3 11 10 4 4852 2 9 5 4778 3 13 10 6 576 3 13 11 7 7034 4 15 14 12 8 5079 1 1 9846 2 17 2 3102 2 17 3 4259 3 19 18 4 1128 2 17 5 4826 3 21 18 6 6731 3 21 19 7 9730 4 23 22 20 8 9613 2 ...
output:
10374
result:
ok single line: '10374'
Test #26:
score: 0
Accepted
time: 0ms
memory: 26488kb
input:
1024 6850 0 1741 1 1 3541 0 6072 1 3 3397 0 9301 2 5 2 4282 0 663 0 8322 1 1 7079 0 4960 1 9 2735 0 3419 1 5 3218 0 6567 1 13 9430 2 15 8 9646 0 1290 0 4552 1 3 2232 1 18 9251 1 5 3293 1 18 3257 1 19 3887 2 20 8 6540 1 17 3182 0 963 0 2721 2 20 12 5797 1 21 6515 3 29 26 22 9179 0 2149 3 30 28 24 223...
output:
10179
result:
ok single line: '10179'
Test #27:
score: 0
Accepted
time: 11ms
memory: 26964kb
input:
1000 10 0 10 0 10 0 10 1 2 10 2 1 3 10 1 3 10 1 2 10 1 6 10 4 3 4 5 8 10 1 1 10 5 1 3 4 7 8 10 0 10 3 2 3 7 10 4 1 3 11 12 10 4 3 7 10 14 10 3 1 10 12 10 2 5 10 10 3 5 7 15 10 5 3 4 9 11 18 10 2 1 19 10 3 9 16 19 10 4 12 15 16 20 10 3 4 21 22 10 8 2 11 12 16 17 18 20 23 10 3 1 19 21 10 3 3 4 5 10 5 ...
output:
1009
result:
ok single line: '1009'
Test #28:
score: 0
Accepted
time: 0ms
memory: 26164kb
input:
1000 4570 0 2749 0 6141 0 7269 0 9260 0 9762 0 6672 0 5718 0 5613 0 7358 0 3321 0 4610 0 8754 0 2737 0 8307 0 4078 0 3060 0 4018 0 7131 0 6761 0 7807 0 7458 0 6290 0 9532 0 8328 0 9838 0 2731 0 9781 0 6284 0 7344 0 8564 0 4778 0 3675 0 4653 0 4587 0 4823 0 9379 0 4182 0 2347 0 6436 0 4581 0 4653 0 6...
output:
9981
result:
ok single line: '9981'
Test #29:
score: 0
Accepted
time: 22ms
memory: 28928kb
input:
894 68151 282 582 745 826 476 286 297 622 728 571 440 270 425 354 616 838 52 715 747 531 596 882 548 806 325 60 725 122 752 881 218 323 368 69 587 347 495 767 265 235 39 110 550 3 517 572 171 643 387 109 804 432 6 343 631 409 713 330 822 405 846 435 315 855 741 148 836 546 627 698 331 230 645 170 60...
output:
999337
result:
ok single line: '999337'
Test #30:
score: 0
Accepted
time: 119ms
memory: 33324kb
input:
400000 492268 0 306510 0 621350 0 864125 0 789614 0 241369 0 289101 0 651444 0 386297 0 119802 0 679778 0 437037 0 473414 0 559250 0 255407 0 820917 0 666720 0 665116 0 550399 0 573837 0 878895 0 648402 0 139466 0 168809 0 722287 0 290931 0 585548 0 373324 0 346731 0 563780 0 309081 0 290818 0 51868...
output:
999597
result:
ok single line: '999597'
Test #31:
score: 0
Accepted
time: 130ms
memory: 41164kb
input:
400000 760285 1 10635 233833 1 227298 319111 1 370669 297876 1 188785 527876 1 342565 866056 1 242331 365795 1 68856 264058 1 131769 461591 1 198995 722330 1 274948 450338 1 100147 365917 1 52485 361403 1 274833 325659 1 110171 227807 1 312061 466082 1 31360 699100 1 149062 617062 1 317079 539390 1 ...
output:
999894
result:
ok single line: '999894'
Test #32:
score: 0
Accepted
time: 129ms
memory: 41640kb
input:
400000 231998 1 162576 639964 1 392033 364252 1 306998 594361 1 279574 477440 1 109351 364401 1 101012 222745 1 347785 273428 1 40600 756540 1 241752 625934 1 219055 394648 1 195862 84689 1 141414 806847 1 273085 918083 1 363625 491198 1 378280 221078 1 66032 320821 1 284216 642611 1 323421 555589 1...
output:
999928
result:
ok single line: '999928'
Test #33:
score: 0
Accepted
time: 138ms
memory: 41268kb
input:
400000 659212 1 136202 600430 1 325323 314599 1 355674 325334 1 354486 374721 1 387734 673003 1 161292 193067 1 197093 908533 1 8994 445879 1 316523 671248 1 211291 856111 1 40622 323194 1 139323 594098 1 345412 742503 1 131090 387867 1 43499 525177 1 117537 462007 1 283633 424803 1 315475 139865 1 ...
output:
999945
result:
ok single line: '999945'
Test #34:
score: 0
Accepted
time: 187ms
memory: 37196kb
input:
400000 911068 0 530003 0 578154 0 558825 2 122611 209545 740410 2 177795 144173 888077 0 830820 0 700526 0 444145 0 224182 2 160279 345516 791655 0 709679 0 676723 0 738724 0 789984 0 660011 0 431764 0 463444 0 663957 2 60261 6744 529381 0 491324 2 216718 282742 353632 2 278457 390947 602997 2 22722...
output:
997935
result:
ok single line: '997935'
Test #35:
score: 0
Accepted
time: 102ms
memory: 46212kb
input:
400000 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1...
output:
1399999
result:
ok single line: '1399999'
Test #36:
score: 0
Accepted
time: 143ms
memory: 38264kb
input:
400000 551969 0 843647 0 396151 0 218798 0 651886 0 640676 0 372975 0 866014 0 662325 0 551258 0 537586 0 803889 0 440926 0 363121 0 521599 0 720830 0 604515 0 248618 0 85577 0 882361 0 585278 0 425990 0 531139 0 641843 0 477892 0 530181 0 262086 0 444819 0 756829 0 886822 0 281472 0 547277 0 195257...
output:
998622
result:
ok single line: '998622'
Test #37:
score: 0
Accepted
time: 137ms
memory: 39840kb
input:
400000 511634 0 462466 0 616150 0 243004 0 788878 0 586084 0 103118 0 66096 0 144630 0 235282 0 511644 0 629444 0 367254 0 155542 0 521720 0 267806 0 511936 0 41762 0 699636 0 513744 0 404188 0 613650 0 596384 0 361512 0 468446 0 152304 0 197170 0 80682 0 637784 0 799684 0 281488 0 356720 0 736132 0...
output:
800000
result:
ok single line: '800000'
Test #38:
score: 0
Accepted
time: 150ms
memory: 45156kb
input:
400000 375104 0 572756 0 199862 0 648206 0 646054 0 516340 0 77206 0 16436 0 754770 0 666446 0 554902 0 324612 0 361338 0 332464 0 539404 0 585864 0 7484 0 749622 0 294096 0 488276 0 709614 0 764048 0 70328 0 273770 0 632760 0 384260 0 306792 0 781796 0 83624 0 113958 0 549132 0 195878 0 443188 0 52...
output:
800000
result:
ok single line: '800000'
Test #39:
score: 0
Accepted
time: 151ms
memory: 45224kb
input:
400000 241751 0 249038 0 897060 0 379014 0 312270 0 120309 0 484306 0 377340 0 883878 0 769765 0 525536 0 765589 0 508501 0 492351 0 601500 0 886933 0 606828 0 120203 0 293385 0 533496 0 666122 0 802497 0 692641 0 215136 0 941397 0 539711 0 418705 0 487116 0 376049 0 642000 0 725532 0 362195 0 50667...
output:
998913
result:
ok single line: '998913'
Test #40:
score: 0
Accepted
time: 200ms
memory: 38300kb
input:
400000 173036 2 5706 96166 390767 0 488781 0 780825 3 84811 78065 382037 428588 0 29055 2 28910 294905 647908 0 29917 3 320900 183187 168416 501729 2 190173 36844 522324 0 566617 0 393231 0 473099 0 573686 2 80158 190890 661102 0 371631 0 223008 0 756880 0 373963 2 21187 378620 800233 1 66735 359114...
output:
999114
result:
ok single line: '999114'
Test #41:
score: 0
Accepted
time: 199ms
memory: 36612kb
input:
400000 365891 3 244090 168191 348099 330665 1 248282 303672 0 376628 2 237754 354316 104821 1 165551 491585 1 95617 437401 2 216721 119328 350758 2 15546 75358 312375 1 317039 711568 2 291759 252558 479143 1 255440 545014 0 418437 1 381363 480609 2 223368 76741 161328 1 27520 301937 1 88349 479919 2...
output:
999860
result:
ok single line: '999860'
Test #42:
score: 0
Accepted
time: 178ms
memory: 37692kb
input:
400000 752376 0 165274 2 125774 214508 159534 1 214854 260160 1 192401 635456 0 552656 0 615970 0 143794 1 371001 559250 0 630436 0 144006 3 256030 145264 161195 120730 3 362204 392614 194673 281504 0 397812 1 156681 283088 2 334907 178205 681952 1 48000 71942 0 291376 0 145332 2 297390 226143 59120...
output:
800000
result:
ok single line: '800000'
Test #43:
score: 0
Accepted
time: 146ms
memory: 42652kb
input:
400000 382760 1 101688 165380 1 284830 44004 1 95671 145080 1 392374 232584 1 314983 5640 1 21432 75616 1 216200 352321 1 398160 384124 1 184115 239684 1 93331 76752 1 250243 54127 1 393634 369998 1 147197 162831 1 296003 269300 1 33741 247792 1 200487 260542 1 394371 251791 1 354657 343809 1 191381...
output:
404712
result:
ok single line: '404712'
Test #44:
score: 0
Accepted
time: 133ms
memory: 33644kb
input:
297871 143337 0 681544 0 814365 0 244428 2 86855 177738 503435 0 646868 0 68869 1 119642 700955 0 370009 0 640363 1 256209 239368 1 178058 310203 1 159438 290895 1 93305 443157 1 24565 691368 1 257135 229939 1 217994 367848 0 784632 0 546257 0 366912 1 37568 330397 1 286777 363091 1 264279 463388 1 ...
output:
998590
result:
ok single line: '998590'
Test #45:
score: 0
Accepted
time: 25ms
memory: 27940kb
input:
49824 25525 2 42681 25206 38158 2 45133 6656 26487 5 31296 47574 30849 6251 1834 17066 3 43847 21500 5599 33362 3 21744 20092 44146 52219 3 28194 13280 7784 17727 4 42821 11437 31155 8883 9188 2 34286 1474 48340 0 29919 4 6242 34471 23381 22098 47526 3 44097 20530 10283 8584 0 16957 3 16278 5655 324...
output:
54536
result:
ok single line: '54536'
Test #46:
score: 0
Accepted
time: 65ms
memory: 30200kb
input:
246454 76818 0 129840 0 433514 0 90138 0 360404 0 483266 0 184394 0 66960 0 486734 0 133952 1 761 490358 0 132682 0 122574 1 143962 61878 0 438046 0 80756 1 230333 272616 0 319572 0 478076 1 149350 355002 0 278690 0 453624 0 203660 0 37698 0 448220 0 12612 0 200792 1 1159 208848 0 47362 1 124460 390...
output:
492908
result:
ok single line: '492908'
Test #47:
score: 0
Accepted
time: 24ms
memory: 27908kb
input:
62427 17361 1 43726 15638 1 29929 37310 1 18799 36958 2 46741 10898 53247 0 32435 3 850 16942 18381 19820 0 25405 0 6744 2 44658 20633 35430 1 40353 46376 0 55009 0 48894 2 11117 3670 48112 0 61220 4 6004 12046 28233 14860 11538 0 38819 2 44597 55868 8976 1 45944 30337 0 5133 0 17967 0 49791 0 50077...
output:
67139
result:
ok single line: '67139'
Test #48:
score: 0
Accepted
time: 47ms
memory: 29768kb
input:
84277 36351 7 59892 44530 31821 52291 79640 65996 22330 52727 4 40895 6387 29472 38416 73995 5 81043 38941 64709 79116 43117 25993 3 2232 20807 51710 48177 5 21461 34017 21710 82746 78516 72345 0 82649 4 78391 79090 70710 34500 66722 6 81852 12176 10828 51371 26038 55225 60563 3 83836 48652 59319 35...
output:
88989
result:
ok single line: '88989'
Test #49:
score: 0
Accepted
time: 26ms
memory: 28064kb
input:
51165 698411 3 25161 33349 29910 407200 2 47845 10809 398300 2 18938 36818 934463 2 43200 29841 322804 4 28127 37259 18223 3704 119937 2 5713 27388 923726 3 47974 21942 34942 54902 3 36921 39984 36228 917658 3 15897 28531 4472 354603 0 149545 3 24378 45994 2843 606069 3 34942 28219 44416 825351 2 49...
output:
999741
result:
ok single line: '999741'
Test #50:
score: 0
Accepted
time: 144ms
memory: 35672kb
input:
343782 528818 1 85259 650922 0 671446 2 25345 294997 405772 0 263688 0 204318 1 252349 345042 0 315890 2 148425 57597 522028 0 341364 0 682730 1 86264 620780 1 74072 422016 0 236158 1 330191 111040 0 480302 1 49960 443346 1 89058 204926 2 170481 139399 469130 0 185466 0 494128 1 30824 570016 0 32845...
output:
687564
result:
ok single line: '687564'
Test #51:
score: 0
Accepted
time: 106ms
memory: 32568kb
input:
317481 440314 0 419586 0 496812 0 71474 2 290277 257760 279502 0 427734 0 182230 1 194879 340082 0 493326 0 18076 1 214402 62838 0 12378 0 520602 0 197522 0 224312 0 631818 0 615056 0 220338 0 262856 0 530932 0 296074 0 599538 0 205544 0 323850 0 137130 1 295611 7240 0 1712 2 141266 159935 54768 1 2...
output:
634962
result:
ok single line: '634962'
Test #52:
score: 0
Accepted
time: 96ms
memory: 31976kb
input:
164829 281185 6 15153 43184 144962 21694 122341 153531 85389 1 59846 455430 3 9044 29333 2127 458092 1 16381 594156 3 137851 127931 80622 248772 5 136423 65445 43188 123341 148463 486215 4 28372 11219 88960 57864 106851 2 72023 97872 176264 3 70473 154346 66392 670682 0 140886 4 12010 17937 61540 11...
output:
998352
result:
ok single line: '998352'
Test #53:
score: 0
Accepted
time: 149ms
memory: 34852kb
input:
302247 489236 0 426984 0 71960 2 113939 157703 600686 0 439576 1 184601 125822 0 600064 0 247332 1 258370 445786 0 443720 1 60528 590750 0 193482 1 160356 266488 0 136976 1 150088 452538 0 331624 0 396670 0 256332 0 285592 1 279476 186540 1 88735 255778 0 33288 1 10735 202034 2 271288 91425 229952 0...
output:
604494
result:
ok single line: '604494'