Submission #43623

#TimeUsernameProblemLanguageResultExecution timeMemory
43623faustaadpTeams (IOI15_teams)C++14
34 / 100
4064 ms11756 KiB
#include "teams.h" #include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ll n,i,j; pair<ll,ll> a[101010]; bool b[101010]; void init(int N, int A[], int B[]) { n=N; for(i=1;i<=n;i++) { a[i]=mp(B[i-1],A[i-1]); } sort(a+1,a+1+n); } int can(int M, int K[]) { memset(b,0,sizeof(b)); sort(K,K+M); for(i=0;i<M;i++) { ll he=K[i]; for(j=1;j<=n;j++) { if(!b[j]&&a[j].se<=K[i]&&K[i]<=a[j].fi) { he--; b[j]=1; } if(he==0) break; } if(he!=0) 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...