제출 #132318

#제출 시각아이디문제언어결과실행 시간메모리
132318reda팀들 (IOI15_teams)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std ; # include "teams.h" vector<pair<int,int>> v; void init( int n , int a[] , int b[]) { for(int i= 0; i < n ; i ++) { v.push_back(make_pair(a[i],b[i])); } sort(v.begin(),v.end()); } bool can(int M, int K[]) { set < pair <int, int> > s; int p = 0; sort(K, K + M); for(int i = 0; i < M; i ++) { int flag = K[i]; while(p < v.size() && flag > 0) { s.insert({v[p].second, p}); p++; while( flag> 0 && !s.empty()) { pair <int, int> it = *s.begin(); if(it.first <= K[i] && K[i] <= v[it.second].first) { s.erase(s.begin()); flag--; } else if(v[it.second].first < K[i])s.erase(s.begin()); else break; } } if(flag > 0) return false; } return true; }

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

teams.cpp: In function 'bool can(int, int*)':
teams.cpp:13:6: error: ambiguating new declaration of 'bool can(int, int*)'
 bool can(int M, int  K[])
      ^~~
In file included from teams.cpp:3:0:
teams.h:5:5: note: old declaration 'int can(int, int*)'
 int can(int M, int K[]);
     ^~~
teams.cpp:21:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while(p < v.size() && flag > 0)
                   ~~^~~~~~~~~~