제출 #204048

#제출 시각아이디문제언어결과실행 시간메모리
204048Segtree팀들 (IOI15_teams)C++14
컴파일 에러
0 ms0 KiB
#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()); } bool 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 'bool can(int, int*)':
teams.cpp:20:6: error: ambiguating new declaration of 'bool can(int, int*)'
 bool can(int M,int K[]){
      ^~~
In file included from teams.cpp:1:0:
teams.h:5:5: note: old declaration 'int can(int, int*)'
 int can(int M, int K[]);
     ^~~
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;
      ~~~~~~~~~^~~~~