이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "teams.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
/*
4
2 4
1 2
2 3
2 3
2
2 1 3
2 1 1
*/
pair<int,int> arr[1000000];
int n;
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<n;i++)arr[i]=pii(A[i],B[i]);
sort(arr,arr+n);
}
int can(int M, int K[]) {
sort(K,K+M);
int pnt=0;
priority_queue<int>pq;
for(int i=0;i<M;i++){
while(pnt<n && arr[pnt].first<=K[i]){
pq.push(arr[pnt].second);
pnt++;
}
while(pq.top()<K[i]){
if(pq.empty())return 0;
pq.pop();
}
for(int j=0;j<K[i];j++){
if(pq.empty())return 0;
pq.pop();
}
}return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |