Submission #384608

#TimeUsernameProblemLanguageResultExecution timeMemory
384608Leonardo_PaesTeams (IOI15_teams)C++17
0 / 100
4099 ms8412 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; #define f first #define s second vector<pii> e; void init(int N, int A[], int B[]) { for(int i=0; i<N; i++){ e.push_back({B[i], A[i]}); } sort(e.begin(), e.end()); } int can(int M, int K[]) { sort(K, K+M); vector<pii> wtf(M); for(int i=0; i<M; i++){ wtf[i] = {K[i], K[i]}; } int i = 0; for(pii p : e){ for(int i=0; i<M; i++){ if(p.s <= wtf[i].f){ wtf[i].s--; break; } } } bool ans = 1; for(int i=0; i<M; i++){ if(wtf[i].s != 0) ans = 0; } return ans; return 0; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:24:11: warning: declaration of 'i' shadows a previous local [-Wshadow]
   24 |   for(int i=0; i<M; i++){
      |           ^
teams.cpp:22:6: note: shadowed declaration is here
   22 |  int i = 0;
      |      ^
teams.cpp:32:10: warning: declaration of 'i' shadows a previous local [-Wshadow]
   32 |  for(int i=0; i<M; i++){
      |          ^
teams.cpp:22:6: note: shadowed declaration is here
   22 |  int i = 0;
      |      ^
teams.cpp:22:6: warning: unused variable 'i' [-Wunused-variable]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...