QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#302618 | #2734. Professional Network | Camillus | 0 | 91ms | 23360kb | C++20 | 1.1kb | 2024-01-11 00:51:18 | 2024-01-11 00:51:18 |
Judging History
answer
#include "bits/stdc++.h"
using ll = long long;
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
vector<int> b(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
cin >> b[i];
}
auto comp_a = [&a](int i, int j) -> bool {
return pair(a[i], i) < pair(a[j], j);
};
auto comp_b = [&b](int i, int j) -> bool {
return pair(b[i], i) < pair(b[j], j);
};
set<int, decltype(comp_a)> Q_a(comp_a);
set<int, decltype(comp_b)> Q_b(comp_b);
for (int i = 0; i < n; i++) {
Q_a.insert(i);
Q_b.insert(i);
}
int cnt = 0;
ll sum = 0;
while (cnt != n) {
if (a[*Q_a.begin()] <= cnt) {
int i = *Q_a.begin();
Q_a.erase(i);
Q_b.erase(i);
} else {
int i = *Q_b.begin();
sum += b[i];
Q_a.erase(i);
Q_b.erase(i);
}
cnt += 1;
}
cout << sum << '\n';
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 2
Accepted
time: 91ms
memory: 23360kb
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: -2
Wrong Answer
time: 43ms
memory: 8840kb
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:
468
result:
wrong answer 1st lines differ - expected: '161', found: '468'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 4
Accepted
time: 0ms
memory: 3556kb
input:
1 0 0
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
10 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000
output:
100000
result:
ok single line: '100000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
10 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0
output:
0
result:
ok single line: '0'
Test #14:
score: -4
Wrong Answer
time: 0ms
memory: 3536kb
input:
10 10 219 9 728 8 425 8 380 7 512 7 617 8 434 9 789 8 74 7 100
output:
2872
result:
wrong answer 1st lines differ - expected: '2360', found: '2872'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%