QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#302622 | #2734. Professional Network | Camillus | 2 | 22ms | 4696kb | C++20 | 852b | 2024-01-11 00:58:37 | 2024-01-11 00:58:37 |
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 = -1;
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 << r << '\n';
return 0;
}
詳細信息
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 15ms
memory: 4696kb
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: 8ms
memory: 3532kb
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: 0
Accepted
time: 7ms
memory: 3540kb
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:
70
result:
ok single line: '70'
Test #4:
score: 0
Accepted
time: 22ms
memory: 4420kb
input:
170783 44747 1 135609 1 113352 1 58387 1 137333 1 64429 1 7175 1 47166 1 145586 1 14618 1 149711 1 39057 1 55998 1 164149 1 68110 1 127423 1 61467 1 121970 1 17368 1 78335 1 18990 1 98187 1 41220 1 116783 1 48224 1 24608 1 120845 1 70767 1 146973 1 120753 1 123122 1 163330 1 28632 1 23622 1 106070 1...
output:
270
result:
ok single line: '270'
Test #5:
score: 0
Accepted
time: 9ms
memory: 3588kb
input:
66865 60318 1 49137 1 12816 1 49625 1 15410 1 21347 1 63569 1 27218 1 54050 1 51307 1 53570 1 4415 1 33854 1 62207 1 43495 1 18414 1 65651 1 10484 1 3007 1 19140 1 19828 1 65632 1 57577 1 65447 1 10176 1 31495 1 63507 1 30997 1 46550 1 48205 1 18848 1 49538 1 17841 1 31052 1 52146 1 23911 1 51971 1 ...
output:
116
result:
ok single line: '116'
Test #6:
score: 0
Accepted
time: 4ms
memory: 3568kb
input:
29828 24608 1 7043 1 7766 1 4137 1 12703 1 14450 1 11287 1 19335 1 17916 1 27603 1 28990 1 3407 1 10602 1 22370 1 25076 1 178 1 18767 1 21309 1 8525 1 360 1 21127 1 15745 1 27308 1 29330 1 25237 1 4847 1 1378 1 4291 1 4307 1 15218 1 6069 1 487 1 29704 1 26279 1 9666 1 21629 1 22287 1 11417 1 822 1 2...
output:
26
result:
ok single line: '26'
Test #7:
score: 0
Accepted
time: 22ms
memory: 4364kb
input:
168118 93498 1 86321 1 14188 1 32790 1 115055 1 44412 1 37530 1 85660 1 113613 1 126419 1 151374 1 142658 1 61013 1 137504 1 93678 1 48203 1 127070 1 49335 1 142436 1 156604 1 124454 1 163945 1 93230 1 156015 1 115075 1 22790 1 66595 1 42094 1 18803 1 8314 1 82281 1 75986 1 160594 1 107559 1 67301 1...
output:
321
result:
ok single line: '321'
Test #8:
score: 0
Accepted
time: 19ms
memory: 4428kb
input:
170861 60502 1 150137 1 124734 1 56205 1 83296 1 49860 1 139506 1 43525 1 39281 1 78434 1 135807 1 59186 1 169643 1 57054 1 87902 1 150880 1 58439 1 104835 1 121734 1 131341 1 111209 1 82864 1 295 1 37507 1 59939 1 3753 1 67129 1 136347 1 99884 1 73530 1 20700 1 41700 1 134765 1 133111 1 22440 1 166...
output:
112
result:
ok single line: '112'
Test #9:
score: 0
Accepted
time: 5ms
memory: 3600kb
input:
34448 17496 1 16403 1 13637 1 32811 1 8133 1 23823 1 24092 1 23336 1 15988 1 4329 1 29185 1 30412 1 29127 1 8914 1 31777 1 24569 1 892 1 5626 1 30874 1 27832 1 17475 1 30296 1 12557 1 18021 1 18489 1 3000 1 260 1 16064 1 4361 1 5342 1 5129 1 11202 1 1194 1 31727 1 25058 1 19730 1 31470 1 2710 1 3274...
output:
176
result:
ok single line: '176'
Test #10:
score: 0
Accepted
time: 10ms
memory: 3908kb
input:
90701 50105 1 37737 1 76000 1 15147 1 49913 1 80397 1 44416 1 75279 1 19401 1 87313 1 88816 1 40457 1 37751 1 23313 1 86289 1 86999 1 21115 1 77874 1 35101 1 66577 1 22561 1 47130 1 5570 1 60516 1 57945 1 66903 1 83194 1 16711 1 4429 1 32939 1 53333 1 75108 1 82155 1 46361 1 67922 1 45929 1 80452 1 ...
output:
178
result:
ok single line: '178'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 4
Accepted
time: 0ms
memory: 3528kb
input:
1 0 0
output:
0
result:
ok single line: '0'
Test #12:
score: -4
Wrong Answer
time: 0ms
memory: 3628kb
input:
10 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000 10 10000
output:
10
result:
wrong answer 1st lines differ - expected: '100000', found: '10'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%