QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#302620 | #2734. Professional Network | Camillus | 0 | 15ms | 4668kb | C++20 | 851b | 2024-01-11 00:57:48 | 2024-01-11 00:57:48 |
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<pair<int, int>> a(n);
for (auto &[x, y] : a) {
cin >> x >> y;
}
ranges::sort(a);
int l = 0;
int r = n;
while (r - l > 1) {
int m = (l + r) / 2;
auto check = [&]() {
int cnt = m;
for (int i = 0; i < n - m; i++) {
if (a[i].first <= cnt) {
cnt += 1;
} else {
return false;
}
}
return true;
};
if (check()) {
r = m;
} else {
l = m;
}
}
cout << l << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 2
Accepted
time: 15ms
memory: 4668kb
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: 8ms
memory: 3636kb
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:
160
result:
wrong answer 1st lines differ - expected: '161', found: '160'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 4
Accepted
time: 0ms
memory: 3524kb
input:
1 0 0
output:
0
result:
ok single line: '0'
Test #12:
score: -4
Wrong Answer
time: 0ms
memory: 3768kb
input:
10 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000
output:
9
result:
wrong answer 1st lines differ - expected: '100000', found: '9'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%