Submission #42223

#TimeUsernameProblemLanguageResultExecution timeMemory
42223yusufakeTeams (IOI15_teams)C++98
Compilation error
0 ms0 KiB
/* ID: ekrem LANG: C++ TASK: teams */ #include <algorithm> #include <iostream> #include <cassert> #include <climits> #include <cstdlib> #include <cstring> #include <iomanip> #include <numeric> #include <cstdio> #include <string> #include <vector> #include <cmath> #include <ctime> #include <queue> #include <stack> #include <map> #include <set> // #include "teams.h" using namespace std; #define foreach(kk,gg) for(__typeof(gg.begin())kk=gg.begin();kk!=gg.end();kk++) #define dbgs(x) cerr << (#x) << " --> " << (x) << ' ' #define dbg(x) cerr << (#x) << " --> " << (x) << endl #define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++) #define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--) #define SET(a, b) memset(a, b, sizeof a) #define heap priority_queue #define orta (bas+son>>1) #define endll puts("") #define mp make_pair #define pb push_back #define sag (k+k+1) #define sol (k+k) #define endl '\n' #define nd second #define st first #define y1 ekrem #define y2 merke typedef int don; #define int long long int inline don read(){don x;scanf(" %d",&x);return x;} typedef pair < int , int > ii; typedef vector < int > vi; typedef vector < ii > vii; const int inf = 1e9 + 7; const int linf = 1e18 + 7; const int NMAX = 5e5 + 5; don N, A[NMAX], B[NMAX], Q, M, K[NMAX]; int n, h[NMAX]; vi g[NMAX]; multiset < int > s; don can(don M, don K[]){ SET(h, 0); FOR(i, 0, M - 1) h[K[i]] += K[i]; s.clear(); FOR(i, 1, n){ foreach(k, g[i]) s.insert(*k); if(h[i]){ int say = h[i]; while(say and !s.empty()){ s.erase(s.begin()); say--; } if(say) return 0; } while(s.count(i)) s.erase(i); } return 1; } void init(don N, don A[], don B[]){ n = N; FOR(i, 0, N - 1) g[A[i]].pb(B[i]); } don main(){ freopen("input.in", "r", stdin);freopen("input.out", "w", stdout); N = read(); FOR(i, 0, N - 1){ A[i] = read(); B[i] = read(); } init(N, A, B); Q = read(); while(Q--){ M = read(); FOR(i, 0, M - 1) K[i] = read(); cout << can(M, K) << endl; } return 0; }

Compilation message (stderr)

teams.cpp: In function 'don can(don, don*)':
teams.cpp:63:23: warning: declaration of 'K' shadows a global declaration [-Wshadow]
 don can(don M, don K[]){
                       ^
teams.cpp:58:32: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
                                ^
teams.cpp:63:23: warning: declaration of 'M' shadows a global declaration [-Wshadow]
 don can(don M, don K[]){
                       ^
teams.cpp:58:29: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
                             ^
teams.cpp: In function 'void init(don, don*, don*)':
teams.cpp:86:34: warning: declaration of 'B' shadows a global declaration [-Wshadow]
 void init(don N, don A[], don B[]){
                                  ^
teams.cpp:58:17: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
                 ^
teams.cpp:86:34: warning: declaration of 'A' shadows a global declaration [-Wshadow]
 void init(don N, don A[], don B[]){
                                  ^
teams.cpp:58:8: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
        ^
teams.cpp:86:34: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 void init(don N, don A[], don B[]){
                                  ^
teams.cpp:58:5: note: shadowed declaration is here
 don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
     ^
teams.cpp: In function 'don main()':
teams.cpp:93:33: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("input.in", "r", stdin);freopen("input.out", "w", stdout);
                                 ^
teams.cpp:93:67: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("input.in", "r", stdin);freopen("input.out", "w", stdout);
                                                                   ^
teams.cpp: In function 'don read()':
teams.cpp:47:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 inline don read(){don x;scanf(" %d",&x);return x;}
                                        ^
/tmp/ccSowJEz.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccp8NcKE.o:teams.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status