QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#664487#7155. Padel Prize Pursuitspycoderyt#50 261ms61788kbC++142.0kb2024-10-21 20:52:452024-10-21 20:52:48

Judging History

你现在查看的是最新测评结果

  • [2024-10-21 20:52:48]
  • 评测
  • 测评结果:50
  • 用时:261ms
  • 内存:61788kb
  • [2024-10-21 20:52:45]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
int id;
int cur[N],loset[4*N],cnt[N],win[4*N],ans[N]; // losing time
struct node{
    int label, ori;
};
vector<node> A[N];
map<int,int> mp;
int n,m,a,b;
// int mxidx=-1,mx=0,oldidx,oldmx;

// the medal that the loss of this created
void dfs(int u,int mx,int mxidx, int par = -1) {
    int cori = mp[u];
    if(mxidx!=-1) {
        // cout << "at " << u << " " << cori << " " << mx << " " << mxidx << "\n";
        ans[mxidx]++;
    }
    for(auto [id,ori] : A[u]) {
        int curmx = mx, curidx = mxidx;
        // add mx in cnt
        cnt[cori] += loset[u] - loset[id];
        // oldidx = mxidx, oldmx = mx;
        // cout << "cnt " << cori << " = " << cnt[cori] << "\n";
        if(cnt[cori] > curmx) {
            curmx = cnt[cori];
            curidx = cori;
        } else if(cnt[cori] == curmx) {
            curidx = min(curidx,cori);
        }
        dfs(id,curmx,curidx,u);
        cnt[cori] -= loset[u] - loset[id];
        // mxidx =  oldidx, mx = oldmx;
        // remove cnt
    }
}
int main() {
    cin>>n>>m;
    id=n+1;
    for(int i = 0;i<n;i++)cur[i]=i,mp[i] = i;
    for(int i = 0;i<m;i++){
        cin>>a>>b; // a beats b
        A[cur[a]].push_back({cur[b],b});
        // cout << cur[a] << " " << a << " " << cur[b] << " " << b << "\n";
        // b loses so gets to reset
        loset[cur[b]] = i;
        win[cur[a]] = 1;
        win[cur[b]] = 0;
        cur[b] = id++;
        mp[cur[b]] = b;
    }
    // dfs for each of the winners in the end
    // for(int i = 0;i<id;i++) {
    //     cout << i << " " << loset[i] << "\n";
    // }
    for(int i = 0;i<id;i++) {
        if(win[i]) {
            // cout << "\nstart " << i << "\n";
            loset[i] = m;
            dfs(i,0,-1);
        }
    }
    for(int i = 0;i<n;i++)cout<<ans[i]<<" ";
}

/*


3 4
0 1
2 1
1 0
2 1

3 7
0 1
0 2
2 0
0 1
1 0
2 0
0 2



*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 86ms
memory: 36060kb

input:

2 200000
0 1
1 0
1 0
1 0
0 1
1 0
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1...

output:

114418 85582 

result:

ok single line: '114418 85582 '

Test #2:

score: 12
Accepted
time: 81ms
memory: 39208kb

input:

2 200000
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0...

output:

78408 121592 

result:

ok single line: '78408 121592 '

Test #3:

score: 12
Accepted
time: 0ms
memory: 14364kb

input:

2 1
1 0

output:

0 1 

result:

ok single line: '0 1 '

Test #4:

score: 12
Accepted
time: 88ms
memory: 25708kb

input:

2 200000
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:

200000 0 

result:

ok single line: '200000 0 '

Subtask #2:

score: 16
Accepted

Test #5:

score: 16
Accepted
time: 4ms
memory: 15012kb

input:

2000 2000
741 1153
839 1048
1159 445
196 1042
404 1319
638 766
1373 621
736 705
1579 1696
454 1566
1794 474
993 858
424 380
1971 210
1729 861
1450 1275
986 535
964 431
1371 1176
658 378
708 1669
1049 1236
832 533
16 450
675 1324
1680 1598
1936 885
579 307
987 1497
996 1589
1087 843
1303 222
105 1692...

output:

0 2 0 4 1 0 5 0 2 2 1 0 0 1 0 1 0 0 1 0 0 1 1 1 3 0 5 0 2 1 2 0 0 0 0 1 5 1 5 3 0 0 1 0 0 0 1 0 0 3 0 1 0 1 1 0 1 0 2 1 0 0 4 0 1 0 0 1 0 0 1 1 0 1 1 2 0 1 0 0 0 0 0 2 0 2 0 0 1 0 0 1 1 0 1 0 2 0 2 3 3 0 0 0 1 2 0 2 2 2 1 1 0 1 2 0 1 1 1 2 1 0 2 0 0 7 0 2 0 3 0 4 0 0 0 0 0 1 2 0 1 2 0 0 1 4 0 0 0 1 ...

result:

ok single line: '0 2 0 4 1 0 5 0 2 2 1 0 0 1 0 ... 0 2 4 0 1 3 2 1 0 2 1 2 2 3 0 '

Test #6:

score: 16
Accepted
time: 2ms
memory: 12072kb

input:

2000 2000
363 1715
1907 76
1670 1939
1548 339
615 1019
232 2
291 680
303 792
697 1835
1575 1724
51 679
459 1241
229 1779
1809 1262
1181 1177
1799 1184
1356 1268
1823 206
1714 576
710 1294
1932 1561
51 679
1276 684
51 679
196 374
1257 154
524 605
1366 763
522 886
357 1873
1491 1178
1798 892
1203 549
...

output:

0 0 1 0 13 0 0 1 0 3 0 0 1 4 0 1 0 0 3 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 1 1 2 1 2 0 4 0 0 0 0 4 0 0 2 5 0 0 0 0 6 0 1 2 0 1 6 0 0 0 0 0 0 1 1 0 0 1 2 6 17 0 1 1 0 0 0 0 1 0 3 0 0 8 0 1 0 2 0 0 0 3 2 0 5 0 0 2 1 1 1 2 0 0 0 0 1 0 2 0 0 1 18 0 0 0 2 0 3 1 0 0 1 0 0 1 4 0 1 0 2 0 1 0 0 1 2 1 0 0 1 0 1...

result:

ok single line: '0 0 1 0 13 0 0 1 0 3 0 0 1 4 0...0 2 0 0 0 14 0 2 1 0 0 0 0 0 1 '

Test #7:

score: 16
Accepted
time: 3ms
memory: 11644kb

input:

2000 2000
162 1885
239 1454
1359 1385
418 582
1589 1593
1213 1513
1336 91
1414 121
1766 313
1589 1294
1454 1369
1139 1177
1177 1178
1432 1580
1448 94
1730 480
1369 1781
1712 386
1894 639
1454 1356
1244 924
582 852
1366 145
1384 1832
1005 61
325 776
816 221
1667 1236
1336 1607
745 1978
1596 1677
641 ...

output:

0 2 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 3 4 0 9 0 0 0 0 3 0 0 0 0 2 0 2 0 0 2 0 3 0 0 0 1 0 0 0 0 3 0 8 0 0 0 0 0 0 0 1 0 0 0 0 2 0 2 0 2 0 0 0 0 0 3 0 0 5 1 0 0 0 0 0 0 0 3 0 0 6 8 0 0 0 0 0 0 0 0 0 0 1 0 0 4 0 5 0 0 5 0 0 0 0 2 0 0 0 0 0 0 5 9 0 0 2 0 0 0 0 0 0 0 ...

result:

ok single line: '0 2 1 0 0 0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 3 0 0 0 5 0 0 0 0 3 0 '

Test #8:

score: 16
Accepted
time: 4ms
memory: 14748kb

input:

2000 2000
220 455
455 800
220 1689
1689 260
1689 1920
455 30
1689 866
1920 419
260 706
800 323
323 1985
220 1046
800 1459
220 1767
1459 525
706 541
419 1766
1689 27
866 1554
1767 1577
1767 1706
1766 79
323 941
79 1313
525 70
1920 242
455 676
1459 287
1313 766
260 658
419 406
706 1964
1985 18
1689 94...

output:

0 0 0 0 0 0 0 0 0 0 6 1 0 0 17 0 0 0 6 0 0 0 0 0 0 0 0 11 12 0 1 0 0 6 2 0 2 0 1 0 0 0 23 0 0 6 0 0 0 0 15 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 2 0 0 1 0 4 0 0 0 1 0 0 0 3 6 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 6 1 0 0 17...3 0 0 2 0 1 3 0 17 0 0 0 0 0 0 '

Test #9:

score: 16
Accepted
time: 0ms
memory: 14908kb

input:

2000 2000
1810 1068
1810 1639
1810 1155
1810 1439
1810 519
1810 1012
1810 1607
1810 1994
1810 590
1810 136
1810 1385
1810 103
1810 1491
1810 1587
1810 137
1810 1166
1810 1843
1810 519
1810 42
1810 1825
1810 1768
1810 1787
1810 1491
1810 743
1810 1998
1810 1850
1810 1680
1810 480
1810 986
1810 368
18...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #10:

score: 16
Accepted
time: 4ms
memory: 13308kb

input:

2000 2000
786 392
392 1361
1361 311
311 1162
1162 394
394 786
786 1162
1162 394
394 786
786 311
311 786
786 394
394 1361
394 1162
1162 311
311 1162
1162 392
392 1162
1162 394
394 786
786 392
392 1361
1361 311
311 1361
1361 311
1361 394
394 1361
1361 786
786 311
311 392
392 1361
1361 1162
1162 394
39...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #11:

score: 16
Accepted
time: 4ms
memory: 11768kb

input:

2000 2000
790 1305
790 1607
1607 738
738 136
136 338
338 1963
1963 733
733 1368
1368 1267
1267 762
762 1802
1802 1100
1100 1488
1488 1028
1028 368
368 911
911 1100
1100 762
762 1377
1377 907
907 1290
1377 733
733 790
790 247
247 1383
1383 102
102 1859
1859 626
626 1231
1231 1597
1597 1164
1164 178
1...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #12:

score: 16
Accepted
time: 3ms
memory: 13100kb

input:

2000 2000
1021 1003
1021 1841
1841 1143
1021 1143
1143 1841
1021 704
704 1841
1021 1333
1021 1003
1021 704
704 1841
1021 1143
1143 1841
1143 704
1143 1333
1333 704
704 1841
1333 1003
1143 1333
1143 704
1021 599
1021 1841
1021 599
1021 1841
1841 704
1841 1003
1841 599
599 1333
599 1333
599 1333
1021 ...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #13:

score: 16
Accepted
time: 0ms
memory: 14976kb

input:

2000 2000
1584 1944
853 1300
193 1550
5 1709
1366 853
43 300
737 1662
1160 1292
1959 1325
1498 875
1532 949
1132 545
1486 815
445 1550
839 802
345 113
579 655
1108 141
1140 1968
1332 1153
1992 537
1921 1329
1325 1959
292 363
1642 1958
934 1694
512 1063
205 1916
1940 1333
1105 1320
56 292
1910 292
13...

output:

0 0 0 0 0 7 0 0 0 1 5 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 49 0 0 0 0 1 0 0 0 0 0 1 0 0 0 2 0 2 0 0 0 1 0 1 1 0 0 2 0 1 5 5 0 1 0 0 0 0 2 1 1 0 0 0 0 0 0 1 1 5 0 1 0 1 0 0 0 1 0 0 2 1 0 0 0 0 0 0 3 0 0 2 0 3 0 0 1 4 0 4 0 1 0 0 1 0 0 2 1 31 1 2 0 0 0 0 2 0 1 0 0 0 0 0 14 1 0 0 2 4 0 0 0 0 0 0 0 1 0 1 1 1 0...

result:

ok single line: '0 0 0 0 0 7 0 0 0 1 5 0 0 0 0 ... 0 0 3 0 0 0 0 2 0 0 0 0 0 0 4 '

Test #14:

score: 16
Accepted
time: 0ms
memory: 12220kb

input:

2000 2000
1799 144
1033 145
1875 1701
1408 1423
333 197
1417 493
145 1359
839 1273
542 1546
1308 1344
1410 77
1025 1377
1417 426
855 212
495 1251
905 611
1539 1350
1325 680
1295 1754
144 450
417 1616
287 1284
1739 997
51 726
262 734
614 86
313 1849
77 1946
151 222
551 624
1420 912
1501 489
1600 667
...

output:

0 0 0 2 0 2 0 0 0 0 0 0 0 3 6 0 0 17 0 0 7 0 0 0 0 0 1 0 1 1 0 11 0 2 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 4 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 5 0 0 0 0 0 3 0 0 0 0 0 0 1 5 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 7 1 0 2 0 2 0 2 0 0 0 0 0 0 0 3 0 0 0 0 0 4 1 1 1 0 0 9 0 0 0 4 0 3 0 0 0 5 4 0 0 0 0 0 4 5 4 0 0 ...

result:

ok single line: '0 0 0 2 0 2 0 0 0 0 0 0 0 3 6 ...0 1 4 1 1 5 4 0 14 0 2 0 0 1 0 '

Test #15:

score: 16
Accepted
time: 3ms
memory: 11568kb

input:

2000 2000
1367 457
1367 1853
1367 459
459 178
459 863
863 457
459 743
743 1853
1853 459
1367 743
743 459
459 1853
743 178
178 863
863 1853
178 457
457 863
178 457
457 459
178 457
457 1853
457 178
178 1853
743 457
457 459
457 743
743 1853
1853 459
1367 459
459 743
459 457
457 1853
459 743
743 863
459...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #16:

score: 16
Accepted
time: 3ms
memory: 13292kb

input:

2000 2000
236 944
944 1282
236 658
658 1524
658 1048
1524 1946
1048 1274
236 458
1946 1258
1946 834
458 867
236 1572
1946 1624
867 369
1048 1883
944 277
944 97
658 661
1258 298
658 1860
97 263
944 136
1946 1270
1572 885
298 453
277 1216
277 791
661 1259
1216 294
834 173
298 1430
294 1220
1048 935
12...

output:

0 0 0 0 0 0 3 0 3 0 1 0 0 1 0 0 1 0 2 0 0 0 0 0 0 1 0 0 0 0 0 0 0 3 0 0 2 1 0 2 0 0 7 0 1 1 0 0 0 4 3 0 0 0 0 1 0 3 3 1 0 0 0 0 0 0 1 0 4 0 0 2 0 0 0 0 0 0 6 1 1 2 0 0 0 1 1 0 0 4 5 0 0 2 3 2 1 5 0 1 0 0 8 1 5 0 0 3 4 2 0 0 0 1 1 3 7 2 0 0 2 1 0 0 3 0 4 5 4 0 0 1 4 3 1 0 4 0 1 1 0 0 0 1 1 0 0 0 2 1 ...

result:

ok single line: '0 0 0 0 0 0 3 0 3 0 1 0 0 1 0 ...2 2 1 0 0 3 3 0 0 0 1 3 20 0 2 '

Test #17:

score: 16
Accepted
time: 0ms
memory: 12264kb

input:

2000 2000
466 347
1906 1039
168 676
760 1433
168 1086
466 1787
168 470
1319 852
168 1458
1677 1028
760 727
1682 1448
727 1554
1514 1979
1787 824
1319 28
347 839
168 672
672 1295
672 1946
824 725
28 963
1787 864
839 542
1554 651
1039 1965
1677 1212
1787 1720
470 830
168 586
542 1218
727 478
839 313
3...

output:

1 0 2 0 0 0 1 0 1 5 2 0 0 0 0 3 0 0 1 4 0 0 0 3 1 8 0 1 4 0 0 0 1 3 4 0 0 0 0 2 0 0 0 0 0 2 0 0 6 0 0 3 1 0 4 0 0 2 0 0 0 0 3 0 2 1 0 1 0 0 0 0 0 0 1 0 0 2 0 0 2 0 0 0 1 1 0 0 0 2 0 6 2 0 3 1 2 3 2 0 0 0 0 1 1 2 0 0 0 3 3 2 3 1 0 4 2 2 0 0 0 1 2 1 0 1 0 1 0 1 0 4 2 0 0 0 1 1 7 0 0 5 2 0 5 2 0 0 2 1 ...

result:

ok single line: '1 0 2 0 0 0 1 0 1 5 2 0 0 0 0 ... 0 0 1 3 2 0 3 1 2 0 0 0 3 1 2 '

Test #18:

score: 16
Accepted
time: 0ms
memory: 14504kb

input:

3 4
0 1
2 1
1 0
2 1

output:

1 1 2 

result:

ok single line: '1 1 2 '

Test #19:

score: 16
Accepted
time: 2ms
memory: 14516kb

input:

3 7
0 1
0 2
2 0
0 1
1 0
2 0
0 2

output:

2 2 3 

result:

ok single line: '2 2 3 '

Test #20:

score: 16
Accepted
time: 2ms
memory: 14824kb

input:

6 10
2 5
3 0
4 2
0 1
4 3
2 4
0 3
0 2
5 2
5 0

output:

5 0 1 1 1 2 

result:

ok single line: '5 0 1 1 1 2 '

Subtask #3:

score: 0
Runtime Error

Test #21:

score: 15
Accepted
time: 79ms
memory: 38356kb

input:

2 200000
0 1
1 0
1 0
1 0
0 1
1 0
0 1
1 0
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
0 1
1 0
0 1
0 1
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
1 0
0 1
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
0 1
0 1
0 1
1 0
0 1...

output:

114418 85582 

result:

ok single line: '114418 85582 '

Test #22:

score: 15
Accepted
time: 86ms
memory: 38376kb

input:

2 200000
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
1 0
0 1
1 0
0 1
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0
0 1
1 0
1 0
1 0...

output:

78408 121592 

result:

ok single line: '78408 121592 '

Test #23:

score: 15
Accepted
time: 2ms
memory: 12948kb

input:

2 1
1 0

output:

0 1 

result:

ok single line: '0 1 '

Test #24:

score: 15
Accepted
time: 88ms
memory: 24484kb

input:

2 200000
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:

200000 0 

result:

ok single line: '200000 0 '

Test #25:

score: 0
Runtime Error

input:

200000 200000
127497 49844
33921 127497
33921 39859
33921 138631
166524 33921
190508 166524
190508 50999
190508 91282
190508 39858
192631 190508
192631 21222
192631 178212
192631 129337
192631 59888
192631 33496
192631 37457
156089 192631
156089 154380
64450 156089
55350 64450
47341 55350
47341 8049...

output:


result:


Subtask #4:

score: 0
Runtime Error

Test #31:

score: 0
Runtime Error

input:

200000 200000
33870 101688
1598 78943
23260 47952
84769 196360
104405 172552
58448 113260
76500 80767
95836 53662
58671 55746
167974 83639
176177 32272
45361 115076
152875 160216
33361 176768
162031 181989
134541 80064
21681 167447
96707 196846
16036 34620
166990 179451
45201 65888
89903 93145
13742...

output:


result:


Subtask #5:

score: 22
Accepted

Test #45:

score: 22
Accepted
time: 258ms
memory: 61788kb

input:

200000 199999
38963 164177
50862 38963
161216 50862
40786 161216
101295 40786
95756 101295
172936 95756
194407 172936
106240 194407
155843 106240
82989 155843
46308 82989
35380 46308
180666 35380
62373 180666
100648 62373
22679 100648
23941 22679
57908 23941
195841 57908
30559 195841
123952 30559
68...

output:

99029 0 0 58510 0 17566 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13996 0 0 0 0 0 0 7679 0 2250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '99029 0 0 58510 0 17566 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #46:

score: 22
Accepted
time: 246ms
memory: 38696kb

input:

200000 199999
71991 169488
146786 107854
28414 125380
84535 950
116408 20502
59780 93568
3641 125626
140641 95712
174416 52557
129197 67781
14945 189486
188533 142712
153256 9038
197250 143580
8468 27391
150740 116154
150633 128866
43920 163109
188350 24110
10621 41212
4843 154899
29633 29615
43347 ...

output:

1 0 0 0 0 0 14 3 1 0 0 0 0 0 3 0 0 4 0 0 0 1 0 0 3 1 1 0 0 0 0 1 1 2 0 0 3 0 0 16 0 0 0 1 0 1 5 0 0 0 0 2 4 5 2 1 0 0 1 0 0 0 0 3 0 2 0 0 1 0 0 0 2 1 0 0 0 4 1 1 0 0 2 0 1 5 3 2 1 0 0 3 0 0 0 0 0 0 0 0 0 0 0 1 5 0 0 0 2 2 0 0 0 0 0 0 1 0 0 1 0 0 0 0 2 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 3 0 0 ...

result:

ok single line: '1 0 0 0 0 0 14 3 1 0 0 0 0 0 3... 0 3 3 0 0 0 0 1 1 0 0 0 0 0 0 '

Test #47:

score: 22
Accepted
time: 141ms
memory: 32588kb

input:

200000 101824
62880 54618
138197 60873
106623 45828
66530 133734
18705 151388
171868 82182
68149 137741
14548 159281
62282 134383
96766 99216
66218 69107
41065 2454
42704 199022
68331 152682
42197 163966
102544 178078
83543 69387
26909 39763
94248 158897
42519 110634
88395 11024
124042 23262
134395 ...

output:

1 10 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 1 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 0 0 1 0 9 1 0 0 0 3 0 0 6 0 0 0 0 1 0 2 0 2 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 2 0 0 4 0 0 4 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0...

result:

ok single line: '1 10 1 0 0 0 0 0 0 0 1 1 0 0 0... 0 0 0 0 0 6 0 0 0 0 1 0 0 1 0 '

Test #48:

score: 22
Accepted
time: 243ms
memory: 39244kb

input:

200000 199990
18850 72950
117437 114341
24427 179676
199809 141259
1448 112104
57677 17577
39128 78174
23148 91037
187016 104236
78569 197554
191663 108798
64860 94661
22853 188252
179249 62134
188553 160
169999 174066
144040 195533
85604 25912
162232 143760
131007 26337
88523 41152
97677 157548
428...

output:

0 0 0 0 1 0 1 0 0 0 0 0 5 0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 1 3 0 0 0 0 3 0 0 0 0 1 0 1 4 1 0 0 0 12 3 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 5 0 1 0 4 6 0 6 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 2 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 8 0 0 0 2 0 5 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 2 0 1 0 0 5...

result:

ok single line: '0 0 0 0 1 0 1 0 0 0 0 0 5 0 0 ... 3 4 0 0 0 0 0 0 8 0 0 0 0 0 3 '

Test #49:

score: 22
Accepted
time: 231ms
memory: 38000kb

input:

200000 199999
161078 106850
43798 105866
7053 158929
21344 67124
154929 159963
148116 89581
31695 71981
139919 67118
158807 136968
126548 25054
175572 61337
77394 162573
194771 143833
76915 13361
15062 184881
199517 115191
136509 176504
2027 176758
50520 59960
189557 70998
30411 76099
40111 123062
3...

output:

4 0 0 0 17 0 0 0 2 0 0 0 0 0 0 0 9 2 16 1 0 0 1 0 0 1 0 2 1 0 4 0 0 0 0 0 0 2 0 0 0 0 1 1 1 0 0 0 0 2 1 5 0 1 0 0 0 6 0 5 0 0 0 0 0 0 1 0 1 5 3 3 1 0 0 1 0 0 0 0 0 0 0 1 2 0 7 0 0 0 2 0 0 3 1 0 6 3 3 0 0 0 0 0 0 0 1 18 2 3 0 0 0 0 0 5 0 0 0 0 0 0 2 2 7 0 0 0 5 0 4 0 0 0 0 0 4 2 0 0 0 0 1 2 3 0 2 0 0...

result:

ok single line: '4 0 0 0 17 0 0 0 2 0 0 0 0 0 0... 0 0 0 0 0 0 2 0 0 0 0 0 0 0 2 '

Test #50:

score: 22
Accepted
time: 194ms
memory: 35876kb

input:

200000 199999
160209 131832
160209 112690
160209 51661
160209 193199
160209 110568
160209 178947
160209 143084
160209 40660
160209 26740
160209 62950
160209 81618
160209 30051
160209 117411
160209 55598
160209 196715
160209 111999
160209 55178
160209 191203
160209 114638
160209 136102
160209 176242
...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #51:

score: 22
Accepted
time: 232ms
memory: 35896kb

input:

200000 199999
183533 139358
84648 177720
11235 162260
179439 146655
119650 65118
96239 119650
169722 14926
34190 80634
29119 24638
177392 182427
49081 179439
198201 49081
22048 198201
169611 155656
61371 177733
137381 4875
35373 79960
29872 169611
52586 190172
14803 22048
8661 40379
171445 114277
86...

output:

0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 17 0 0 0 0 0 0 0 0 0 1 0 0 0 7 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 ... 0 0 0 8 0 0 0 0 3 0 4 0 0 0 0 '

Test #52:

score: 22
Accepted
time: 232ms
memory: 35812kb

input:

200000 199999
64458 197472
67762 148239
96350 57399
170378 140168
153346 126933
12587 46756
74008 51150
63001 75566
4973 104566
165281 140999
5413 119888
61702 160453
155505 23102
122158 147048
178194 179786
107268 56353
139335 97771
58616 148792
186384 56479
183582 86573
112175 33504
120252 32265
7...

output:

1 0 0 0 2 2 0 0 0 0 0 0 1 0 4 3 3 0 0 0 0 0 0 2 0 1 2 8 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 1 1 6 1 1 0 4 3 0 8 0 3 0 0 0 2 0 0 0 3 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1 4 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 5 0 2 1 0 1 6 0 0 1 0 0 0 0 2 0 0 2 0 ...

result:

ok single line: '1 0 0 0 2 2 0 0 0 0 0 0 1 0 4 ... 0 0 2 4 0 0 1 1 0 0 0 1 0 2 0 '

Test #53:

score: 22
Accepted
time: 208ms
memory: 37848kb

input:

200000 199999
120776 141715
186264 95132
161778 133292
111986 140582
46169 111936
70300 85966
86242 5048
45237 195124
117877 144008
174419 73317
168100 83302
186264 95358
85450 13393
1 144786
55493 77958
176806 27614
53446 94393
117639 163782
193357 45414
108226 118419
100272 174248
23726 50840
5904...

output:

0 1 0 3 4 0 0 0 0 0 0 0 5 0 0 2 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 2 4 0 0 0 0 1 0 1 0 0 3 1 0 1 0 0 0 1 0 0 0 3 0 0 0 0 0 0 2 0 4 0 3 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 4 0 0 0 0 0 0 7 0 0 0 0 1 0 0 0 0 0 3 0 0 5 0 8 0 0 0 0 2 0 0 0 0 4 0 0 0 0 1 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 4 10 2 1 0...

result:

ok single line: '0 1 0 3 4 0 0 0 0 0 0 0 5 0 0 ... 4 0 0 0 0 0 0 0 0 0 0 0 0 0 1 '

Test #54:

score: 22
Accepted
time: 240ms
memory: 37876kb

input:

200000 199999
93836 67261
7072 54020
72514 118489
70075 94382
49095 771
127986 164268
124592 131875
198833 22689
130204 137986
40481 139005
122199 121666
77823 103662
57031 167521
19406 60118
86920 104895
88542 75143
15599 1124
26701 64650
137099 137527
54421 109170
194380 136498
9932 51444
159281 4...

output:

1 0 0 1 4 0 0 7 1 0 2 2 0 2 0 0 0 7 1 2 2 0 0 0 0 0 2 0 2 0 0 2 0 0 2 0 0 5 0 1 1 0 1 0 0 1 0 0 8 2 0 0 0 0 2 0 0 4 0 1 0 0 0 0 0 9 0 0 0 2 0 2 3 1 0 0 0 2 0 0 0 0 2 0 0 0 1 0 0 0 0 0 3 0 0 7 1 2 0 1 1 0 0 1 1 0 0 0 0 3 0 0 0 2 0 0 0 0 1 0 0 1 2 2 0 3 1 0 0 0 2 0 0 1 2 8 0 0 1 0 2 2 0 0 0 0 3 0 0 0 ...

result:

ok single line: '1 0 0 1 4 0 0 7 1 0 2 2 0 2 0 ... 0 0 0 0 0 3 0 2 0 4 0 0 5 0 3 '

Test #55:

score: 22
Accepted
time: 261ms
memory: 42564kb

input:

200000 199999
14065 102792
65336 14065
106880 65336
170509 106880
95179 174332
128808 170509
182866 128808
95179 182866
112897 158304
95179 112897
59708 95179
78611 59708
71556 78611
71556 129231
162284 71556
162284 92465
195579 162284
26692 195579
9071 18053
68717 148794
26692 68717
198485 26692
86...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%