QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#302621#2734. Professional NetworkCamillus0 15ms4612kbC++20851b2024-01-11 00:58:052024-01-11 00:58:06

Judging History

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

  • [2024-01-11 00:58:06]
  • 评测
  • 测评结果:0
  • 用时:15ms
  • 内存:4612kb
  • [2024-01-11 00:58:05]
  • 提交

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 << r << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 15ms
memory: 4612kb

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:

1

result:

wrong answer 1st lines differ - expected: '0', found: '1'

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 0ms
memory: 3544kb

input:

1
0 0

output:

1

result:

wrong answer 1st lines differ - expected: '0', found: '1'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%