QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#302654#2734. Professional NetworkCamillusCompile Error//C++20619b2024-01-11 02:06:352024-01-11 02:06:36

Judging History

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

  • [2024-01-11 02:06:36]
  • 评测
  • [2024-01-11 02:06:35]
  • 提交

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;
    deque<pair<int, int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a.begin(), a.end());
    int res = 0;
    int k = 0;
    while (!a.empty()) {
        while (!a.empty() && a[i].first < k) {
            res++;
            k++;
            a.pop_back();
        }
        if (!a.empty()) {
            k++;
            a.pop_front();
        }
    }
    cout << res;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:19:32: error: ‘i’ was not declared in this scope
   19 |         while (!a.empty() && a[i].first < k) {
      |                                ^