Submission #285437

#TimeUsernameProblemLanguageResultExecution timeMemory
285437OzyTeams (IOI15_teams)C++17
0 / 100
4074 ms51932 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = (a); i <= (b); i++) #define debug(a) cerr << #a << " = " << a << endl; struct x{ int fin; int ini; int id; bool operator < (const x &a) const { return fin < a.fin; } }; set<x> rangos; set<x>::iterator pos; int visitados[100002]; void init(int N, int A[], int B[]) { rep(i,0,N-1) rangos.insert({B[i],A[i],i}); } int can(int M, int K[]) { int sum; rep(i,0,100000) visitados[i] = 0; sort(K,K+M); rep(i,0,M) { sum = 0; pos = rangos.lower_bound({K[i],0,0}); while(pos != rangos.end() && sum < K[i]) { if ((*pos).ini <= K[i] && visitados[(*pos).id] == 0) { sum++; visitados[(*pos).id] = 0; } pos++; } if (sum < K[i]) return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...