제출 #134570

#제출 시각아이디문제언어결과실행 시간메모리
134570Boxworld팀들 (IOI15_teams)C++14
0 / 100
4070 ms12280 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; struct S{int l,r;}a[100100]; bool cmp(S x,S y){return x.l<y.l?1:(x.r<y.r?1:0);} int n; void init(int N, int A[], int B[]){ n=N; for (int i=0;i<N;i++){ a[i].l=A[i];a[i].r=B[i]; } // sort(a,a+N,cmp); // for (int i=0;i<N;i++)printf("L:%d R:%d\n",a[i].l,a[i].r); } int can(int M, int K[]){ priority_queue<P,vector<P>,greater<P> >Q; sort(K,K+M); for (int i=0;i<n;i++)Q.push(make_pair(a[i].l,a[i].r)); for (int i=0;i<M;i++){ if (Q.empty())return 0; if (Q.size()<K[i])return 0; for (int j=0;j<K[i];j++){ P x=Q.top(); Q.pop(); if (x.first<=K[i]&&K[i]<=x.second)continue; else return 0; } P x=Q.top();Q.pop(); while(x.first<=K[i]){ if (K[i]<x.second)Q.push(make_pair(K[i]+1,x.second)); x=Q.top();Q.pop(); } } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:22:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (Q.size()<K[i])return 0;
             ~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...