Submission #65218

#TimeUsernameProblemLanguageResultExecution timeMemory
65218TalantTeams (IOI15_teams)C++17
34 / 100
4032 ms24484 KiB
#include "teams.h" //#include "grader.cpp" #include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb push_back using namespace std; const int NN = (1e6 + 5); const int inf = (1e9 + 7); int n,m; int a[NN],b[NN]; int k[NN]; int u[NN]; vector <pair<int,int> > v; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i ++) a[i] = A[i],b[i] = B[i]; } int can(int M, int K[]) { int m = M; v.clear(); for (int i = 0; i < m; i ++) k[i] = K[i]; sort (k,k + m); for (int i = 0; i < n; i ++) v.pb(mk(b[i],a[i])),u[i] = 0; sort (v.begin(),v.end()); for (int i = 0; i < m; i ++) { int cn = 0; for (int j = 0; j < n; j ++) { if (!u[j] && v[j].fr >= k[i] && v[j].sc <= k[i]) u[j] = 1,cn ++; if (cn == k[i]) break; } if (cn != k[i]) return 0; } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:30:11: warning: declaration of 'm' shadows a global declaration [-Wshadow]
       int m = M;
           ^
teams.cpp:16:7: note: shadowed declaration is here
 int n,m;
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...