제출 #727679

#제출 시각아이디문제언어결과실행 시간메모리
727679mgl_diamond팀들 (IOI15_teams)C++14
34 / 100
4072 ms9944 KiB
#include <bits/stdc++.h>

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define C make_pair
#define vec vector
#define ins push_back
#define fi first
#define se second

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 1e5+5;
int n;
ii guy[N];

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

bool can(int M, int K[]) {
    priority_queue<int> pq;
    
    sort(K, K+M);
    for(int i=0, j=0; i<M; ++i) {
        while (j<n && guy[j].fi <= K[i])
            pq.push(-guy[j++].se);
        
        while (!pq.empty() && -pq.top() < K[i]) 
            pq.pop();

        while (K[i]--) {
            if (pq.empty()) return 0;
            pq.pop();
        }
    }

    return 1;
}

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:19:15: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   19 | void init(int N, int A[], int B[]) {
      |           ~~~~^
teams.cpp:15:11: note: shadowed declaration is here
   15 | const int N = 1e5+5;
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...