QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#664558#7155. Padel Prize PursuitWarinchai_s#16 21ms19736kbC++141.3kb2024-10-21 21:11:332024-10-21 21:11:33

Judging History

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

  • [2024-10-21 21:11:33]
  • 评测
  • 测评结果:16
  • 用时:21ms
  • 内存:19736kb
  • [2024-10-21 21:11:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int mx=0;
int ans[2005];
vector<int>medals[2005];
int cnt[2005][2005];
int most[2005];
int id[2005];
int prv[2005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;cin>>n>>m;
    //cerr<<"work\n";
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        for(auto x:medals[b]){
            cnt[x][b]+=i-prv[b];
            if(cnt[x][b]>most[x])most[x]=cnt[x][b],id[x]=b;
            else if(cnt[x][b]==most[x])id[x]=min(id[x],b);
        }
        for(auto x:medals[a]){
            cnt[x][a]+=i-prv[a];
            if(cnt[x][a]>most[x])most[x]=cnt[x][a],id[x]=a;
            else if(cnt[x][a]==most[x])id[x]=min(id[x],a);
        }
        for(auto x:medals[b])medals[a].push_back(x);
        medals[b].clear();
        medals[a].push_back(i);
        prv[a]=i;
    }
    for(int i=0;i<n;i++){
        int b=i;
        for(auto x:medals[b]){
            cnt[x][b]+=m-prv[b];
            if(cnt[x][b]>most[x])most[x]=cnt[x][b],id[x]=b;
            else if(cnt[x][b]==most[x])id[x]=min(id[x],b);
        }
    }
    for(int i=0;i<m;i++){
        ans[id[i]]++;
    }
    for(int i=0;i<n;i++){
        cout<<ans[i]<<" ";
    }

}
/*
3 4
0 1
2 0
1 2
2 1

3 4
0 1
2 1
1 0
2 1
*/

詳細信息

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

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:


result:


Subtask #2:

score: 16
Accepted

Test #5:

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

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: 0ms
memory: 13872kb

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: 16872kb

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: 3ms
memory: 19736kb

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: 21ms
memory: 11676kb

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: 7ms
memory: 18760kb

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: 3ms
memory: 19560kb

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: 15316kb

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: 3ms
memory: 14700kb

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: 4ms
memory: 15688kb

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: 19452kb

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: 12680kb

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: 12848kb

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: 3624kb

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: 0ms
memory: 3712kb

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: 0ms
memory: 3720kb

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: 0
Runtime Error

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:


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: 0
Runtime Error

Test #45:

score: 0
Runtime Error

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:


result:


Subtask #6:

score: 0
Skipped

Dependency #1:

0%