제출 #434334

#제출 시각아이디문제언어결과실행 시간메모리
434334benedict0724팀들 (IOI15_teams)C++17
34 / 100
4088 ms19780 KiB
#include "teams.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> student[100002];
struct state
{
    int a, b;
    state() :state(0, 0) {}
    state(int _a, int _b) : a(_a), b(_b) {}
    bool operator < (const state &O) const
    {
        return b > O.b;
    }
};
int idx[100002];
int n;

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

int can(int M, int K[]) {
    priority_queue<state> pq;
    int now = -1;
    sort(K, K+M);
    for(int i=0;i<M;i++)
    {
        if(K[i] > now)
        {
            for(int k=now+1;k<=K[i];k++) for(int j : student[k]) pq.push(state(k, j));
            now = K[i];
        }

        for(int j=0;j<K[i];j++)
        {
            while(!pq.empty() && pq.top().b < K[i]) pq.pop();
            if(pq.empty()) return 0;
            pq.pop();
        }
    }
	return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...