QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#882207#2787. TeamsthangthangCompile Error//C++201.2kb2025-02-04 22:07:022025-02-04 22:07:09

Judging History

This is the latest submission verdict.

  • [2025-02-04 22:07:09]
  • Judged
  • [2025-02-04 22:07:02]
  • Submitted

answer

#ifdef ONLINE_JUDGE

#include "teams.h"

#endif // ONLINE_JUDGE

#include <bits/stdc++.h>

using namespace std;

const int MaxN = 5e5 + 5;

int n, a[MaxN], b[MaxN];
int q, m, k[MaxN];
vector <int> ri[MaxN];

void init(int N, int A[], int B[]){
    n = N;
    for (int i = 0; i < n; ++ i)
        ri[A[i]].push_back(B[i]);
}

int query[MaxN];

bool can(int M, int K[]){
    for (int i = 0; i < M; ++ i)
        query[K[i]] ++;

    priority_queue <int, vector <int>, greater <int>> pq;

    for (int l = 1; l <= n; ++ l){
        while (pq.size() && pq.top() < l) pq.pop();
        for (int r : ri[l]) pq.push(r);
        for (int loops = 0; loops < query[l] * l; loops ++){
            if (pq.empty()) return 0;
            pq.pop();
        }
    }

    return 1;
}

#ifndef ONLINE_JUDGE

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n;
    for (int i = 0; i < n; ++ i)
        cin >> a[i] >> b[i];

    init(n, a, b);

    cin >> q;
    for (int loops = 0; loops < q; ++ loops){
        cin >> m;
        for (int i = 0; i < m; ++ i)
            cin >> k[i];

        cout << can(m, k) << "\n";
    }
}

#endif // ONLINE_JUDGE

Details

answer.code:25:6: error: ambiguating new declaration of ‘bool can(int, int*)’
   25 | bool can(int M, int K[]){
      |      ^~~
In file included from answer.code:3:
teams.h:5:5: note: old declaration ‘int can(int, int*)’
    5 | int can(int M, int K[]);
      |     ^~~