Submission #746179

#TimeUsernameProblemLanguageResultExecution timeMemory
746179Username4132Teams (IOI15_teams)C++14
0 / 100
391 ms25100 KiB
#include "teams.h" #include<iostream> #include<vector> #include<algorithm> using namespace std; using pii = pair<int, int>; #define forn(i, n) for(int i=0; i<(int)n; ++i) #define forsn(i, s, n) for(int i=s; i<(int)n; ++i) #define dforn(i, n) for(int i=n-1; i>=0; --i) #define PB push_back #define F first #define S second const int MAXN=500010, MAXM=200010, SQ=710; int n, req[MAXM], nore[SQ], arr[SQ][SQ], aa[MAXN], bb[MAXN]; void init(int N, int A[], int B[]) { n=N; forn(i, n) aa[i]=A[i], bb[i]=B[i]; } int can(int m, int K[]) { sort(K, K+m); int sz=0; forn(i, m){ if(i==0 || K[i]!=K[i-1]) nore[sz]=K[i], req[sz]=1, ++sz; else req[sz-1]++; } forn(i, sz) forsn(j, i, sz+1) arr[i][j]=0; forn(i, n){ auto itl = lower_bound(nore, nore+sz, aa[i]); auto itr = upper_bound(nore, nore+sz, bb[i]); arr[itl-nore][itr-nore]++; } forn(i, sz){ forsn(j, i+1, sz+1){ if(req[i]>arr[i][j]) req[i]-=arr[i][j], arr[i][j]=0; else{ req[i]=0; arr[i][j]-=req[i]; break; } } if(req[i]>0) return 0; forsn(j, i+2, sz+1) arr[i+1][j]+=arr[i][j]; } 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...