제출 #253413

#제출 시각아이디문제언어결과실행 시간메모리
253413tinjyu마상시합 토너먼트 (IOI12_tournament)C++14
49 / 100
497 ms43896 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] && tag[j]==0) { son[i][0]++; son[i][son[i][0]]=j; if(cnt!=S[i])tag[j]=1; //cout<<son[i][son[i][0]]<<" "; } } //cout<<endl; } 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]; //for(int j=0;j<n;j++)cout<<k[j]<<" "; //cout<<endl; long long int ma=0; for(int l=1;l<=c;l++) { ma=0; for(int j=1;j<=son[l][0];j++) { ma=max(k[son[l][j]],ma); } if(ma==r)cnt++; k[son[l][1]]=ma; } //cout<<i<<" "<<cnt<<endl; if(cnt>ans) { ans=cnt; p=i; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...