이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"teams.h"
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
vector<P> v;
void init(int N,int A[],int B[]){
rep(i,N)v.push_back(make_pair(A[i],B[i]));
sort(v.begin(),v.end());
}
int can(int M,int K[]){
sort(K,K+M);
priority_queue<ll,vector<ll>,greater<ll> >pq;
int j=0;
rep(i,M){
for(;j<v.size()&&v[j].first<=K[i];j++){
pq.push(v[j].second);
}
while(!pq.empty()){
if(pq.top()<K[i])pq.pop();
else break;
}
if(pq.size()<K[i])return 0;
rep(k,K[i])pq.pop();
}
return 1;
}
/*
int main(){
int n,a[110],b[110];
cin>>n;
rep(i,n)cin>>a[i]>>b[i];
init(n,a,b);
while(1){
int m,k[110];
cin>>m;
rep(i,m)cin>>k[i];
cout<<(can(m,k)?"YES":"NO")<<endl;
}
}*/
컴파일 시 표준 에러 (stderr) 메시지
teams.cpp: In function 'int can(int, int*)':
teams.cpp:25:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(;j<v.size()&&v[j].first<=K[i];j++){
~^~~~~~~~~
teams.cpp:32:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(pq.size()<K[i])return 0;
~~~~~~~~~^~~~~
# | 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... |