QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#664821#7155. Padel Prize Pursuitnjoop#0 120ms28880kbC++171.2kb2024-10-21 22:33:302024-10-21 22:33:31

Judging History

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

  • [2024-10-21 22:33:31]
  • 评测
  • 测评结果:0
  • 用时:120ms
  • 内存:28880kb
  • [2024-10-21 22:33:30]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

unordered_map<int, int> mp[200010];
int m, n, x, y, mx[200010], idx[200010], cnt[200010];
vector<pair<int, int>> med[200010];

int main() {
    cin >> n >> m;
    for(int i=0; i<m; i++) {
        cin >> x >> y;
        med[x].push_back({i, i});
        for(auto j: med[y]) {
            mp[j.second][y] += i-j.first;
            //cout << i << " " << x << " " << y << " " << j.first << " " << j.second << " " << mp[j.second][y] << "\n"; 
            if(mp[j.second][y] > mx[j.second]) {
                mx[j.second] = mp[j.second][y];
                idx[j.second] = y;
            } 
            med[x].push_back({i, j.second});
        }
        med[y].clear();
        if(i != m-1) continue;
        for(auto j: med[x]) {
            mp[j.second][x] += i+1-j.first;
            if(mp[j.second][x] > mx[j.second]) {
                mx[j.second] = mp[j.second][x];
                idx[j.second] = x;
            }
        }
    }
    for(int i=0; i<m; i++) {
        //cout << i << " " << mx[i] << " " << idx[i] << "--\n";
    }
    for(int i=0; i<m; i++) {
        cnt[idx[i]]++;
    }
    for(int i=0; i<n; i++) {
        cout << cnt[i] << " ";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

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: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 21684kb

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:

1242 3 0 1 0 0 0 0 2 2 1 1 2 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 2 0 2 0 0 0 0 1 0 0 0 2 0 1 0 2 3 0 0 0 0 0 0 1 0 0 0 1 0 0 2 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 1 3 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 2 0 2 2 0 1 0 0 1 2 0 2 0 3 0 0 0 0 0 1 8 0 0 0 0 0 4 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0...

result:

wrong answer 1st lines differ - expected: '0 2 0 4 1 0 5 0 2 2 1 0 0 1 0 ...2 0 2 4 0 1 3 2 1 0 2 1 2 2 3 0', found: '1242 3 0 1 0 0 0 0 2 2 1 1 2 0... 0 2 0 0 1 0 0 0 0 2 0 0 0 4 1 '

Subtask #3:

score: 0
Time Limit Exceeded

Test #21:

score: 0
Time Limit Exceeded

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
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 120ms
memory: 28880kb

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:

176398 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 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 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 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0...

result:

wrong answer 1st lines differ - expected: '0 2 0 1 1 0 0 0 1 0 0 1 0 1 1 ...5 0 0 0 0 0 3 0 1 0 2 2 0 0 2 0', found: '176398 0 1 0 0 0 0 0 1 0 1 0 0... 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 '

Subtask #5:

score: 0
Time Limit Exceeded

Test #45:

score: 0
Time Limit Exceeded

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%