제출 #887634

#제출 시각아이디문제언어결과실행 시간메모리
887634JakobZorz마상시합 토너먼트 (IOI12_tournament)C++17
0 / 100
1054 ms1580 KiB
#include<vector> #include<iostream> using namespace std; typedef long long ll; int GetBestPosition(int n,int c,int r,int *K,int *L,int *R){ for(int i=0;i<c;i++) R[i]++; vector<int>present(n,1); for(int j=0;j<c;j++){ int sum=0; int l=n,r=n; for(int i=0;i<n;i++){ if(sum==L[j]&&l==n) l=i; if(sum==R[j]) r=i; sum+=present[i]; } L[j]=l; R[j]=r; for(int i=l;i<r-1;i++) present[i]=0; } vector<int>arr_glob(n-1); for(int i=0;i<n-1;i++) arr_glob[i]=K[i]; int max_res=-1; int i_res=0; for(int ins=0;ins<n;ins++){ vector<int>arr=arr_glob; arr.insert(arr.begin()+ins,r); int res=0; for(int j=0;j<c;j++){ int m=0; for(int i=L[j];i<R[j];i++) m=max(m,arr[i]); res+=m==r; } //cout<<ins<<" "<<res<<"\n"; if(res>max_res){ max_res=res; i_res=ins; } } return i_res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...