Submission #253409

#TimeUsernameProblemLanguageResultExecution timeMemory
253409tinjyuJousting tournament (IOI12_tournament)C++14
0 / 100
515 ms42704 KiB
#include <iostream> using namespace std; long long int k[100005],n,c,r,son[5005][5005],tag[100005]; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { n=N; c=C; r=R; for(int i=0;i<c;i++) { long long int cnt=-1; for(int j=0;j<n;j++) { if(tag[j]==0)cnt++; if(cnt>=S[i] && cnt<=E[i]) { son[i][0]++; son[i][son[i][0]]=j; if(cnt!=0)tag[j]=1; } } } long long int ans=0,p=0; for(int i=0;i<n;i++) { k[i]=r; long long int cnt=0; for(int j=0;j<i;j++)k[j]=K[j]; for(int j=i+1;j<n;j++)k[j]=k[j-1]; long long int ma=0; for(int l=1;l<=c;l++) { for(int j=1;j<=son[i][0];j++) { ma=max(son[i][j],ma); } if(ma==r)cnt++; k[son[i][1]]=ma; } if(ma>ans) { ans=ma; p=i; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...