Submission #887641

#TimeUsernameProblemLanguageResultExecution timeMemory
887641JakobZorzJousting tournament (IOI12_tournament)C++17
17 / 100
1056 ms860 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==n) r=i; sum+=present[i]; } L[j]=l; R[j]=r; //cout<<l<<" "<<r<<"\n"; 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 i:arr) //cout<<i<<" "; //cout<<"\n"; 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...