QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#304868 | #2734. Professional Network | Camillus | 0 | 49ms | 20468kb | C++20 | 716b | 2024-01-14 04:45:32 | 2024-01-14 04:45:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = int(3e5) + 99;
int t, n;
vector <int> v[N];
int main() {
int t = 1;
for(int tc = 0; tc < t; ++tc){
scanf("%d", &n);
for(int i = 0; i < n; ++i)
v[i].clear();
for(int i = 0; i < n; ++i){
int x, s;
scanf("%d %d", &x, &s);
v[x].push_back(s);
}
multiset <int > q;
long long res = 0;
int pref = n;
int cnt = 0;
for(int i = n - 1; i >= 0; --i){
pref -= v[i].size();
int need = i - pref;
for(auto x : v[i]) q.insert(x);
while(cnt < need){
++cnt;
res += *q.begin();
q.erase(q.begin());
}
}
printf("%lld\n", res);
}
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 2
Accepted
time: 49ms
memory: 20468kb
input:
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 0...
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 9ms
memory: 14564kb
input:
55848 8787 1 40423 1 4209 1 45140 1 40852 1 4984 1 48967 1 28225 1 8553 1 29753 1 24173 1 12996 1 41846 1 19903 1 42728 1 18675 1 18103 1 45100 1 1689 1 34439 1 4780 1 3489 1 27184 1 5120 1 33927 1 54366 1 36868 1 34457 1 21443 1 2077 1 3841 1 11477 1 14409 1 37845 1 2713 1 2799 1 31291 1 53308 1 49...
output:
161
result:
ok single line: '161'
Test #3:
score: -2
Wrong Answer
time: 13ms
memory: 14252kb
input:
51128 47540 1 26373 1 1854 1 36998 1 19702 1 21805 1 6339 1 1544 1 5966 1 50331 1 10629 1 19621 1 49594 1 14541 1 45771 1 37463 1 18140 1 39362 1 6482 1 45363 1 15806 1 46123 1 37409 1 36864 1 611 1 6918 1 15436 1 27465 1 25213 1 23095 1 33022 1 33715 1 48048 1 4654 1 35761 1 44253 1 31240 1 13642 1...
output:
69
result:
wrong answer 1st lines differ - expected: '70', found: '69'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 4
Accepted
time: 0ms
memory: 10848kb
input:
1 0 0
output:
0
result:
ok single line: '0'
Test #12:
score: -4
Wrong Answer
time: 2ms
memory: 11056kb
input:
10 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000
output:
0
result:
wrong answer 1st lines differ - expected: '100000', found: '0'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%