제출 #396327

#제출 시각아이디문제언어결과실행 시간메모리
396327definitelynotmee팀들 (IOI15_teams)C++98
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "teams.h" #define mp make_pair #define mt make_tuple #define ff first #define ss second using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INFL = (1LL<<62)-1; const int INF = (1<<30)-1; const int MAXN = 500001; int n; pii v [MAXN]; void init (int N, int A[], int B[]){ n = N; for(int i = 0; i < n; i++){ v[i] = {A[i], B[i]}; } sort(v, v+n); } bool can (int m, int k[]){ sort(k, k+m); multiset<int> active; int p1 = 0, p2 = 0; for(int i = 1; i <= n && p2 < m; i++){ while(p1 < n && v[p1].ff == i){ active.insert(v[p1].ss); p1++; } while(p2 < m && k[p2] == i){ if(active.size() < k[p2]) return 0; for(int j = 0; j < k[p2]; j++) active.erase(active.begin()); p2++; } } return 1; }

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

teams.cpp:27:6: error: ambiguating new declaration of 'bool can(int, int*)'
   27 | bool can (int m, int k[]){
      |      ^~~
In file included from teams.cpp:2:
teams.h:5:5: note: old declaration 'int can(int, int*)'
    5 | int can(int M, int K[]);
      |     ^~~
teams.cpp: In function 'bool can(int, int*)':
teams.cpp:37:30: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |             if(active.size() < k[p2])
      |                ~~~~~~~~~~~~~~^~~~~~~