QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#302620#2734. Professional NetworkCamillus0 15ms4668kbC++20851b2024-01-11 00:57:482024-01-11 00:57:48

Judging History

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

  • [2024-01-11 00:57:48]
  • 评测
  • 测评结果:0
  • 用时:15ms
  • 内存:4668kb
  • [2024-01-11 00:57:48]
  • 提交

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%