Submission #57858

#TimeUsernameProblemLanguageResultExecution timeMemory
57858E869120Teams (IOI15_teams)C++14
34 / 100
4018 ms20284 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; vector<pair<int,int>>vec;int N;bool used[100009]; void init(int NN, int A[], int B[]) { N=NN; for(int i=0;i<N;i++) vec.push_back(make_pair(B[i],A[i])); sort(vec.begin(),vec.end()); } int can(int M, int K[]) { for(int i=0;i<N;i++) used[i]=false; sort(K,K+M); int cx=0; for(int i=0;i<M;i++){ int cnt=0; for(int j=0;j<N;j++){ if(used[j]==true) continue; if(vec[j].second<=K[i] && K[i]<=vec[j].first) { cnt++;used[j]=true; } if(cnt==K[i]) break; } if(cnt!=K[i]) return 0; } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:17:6: warning: unused variable 'cx' [-Wunused-variable]
  int cx=0;
      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...