제출 #746180

#제출 시각아이디문제언어결과실행 시간메모리
746180Username4132팀들 (IOI15_teams)C++14
0 / 100
390 ms21792 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[]) { int suu=0; forn(i, m){ suu+=K[i]; if(suu>n) return 0; } 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) req[i]*=nore[i]; forn(i, sz) forsn(j, i+1, 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...