Submission #69808

#TimeUsernameProblemLanguageResultExecution timeMemory
69808FedericoSJousting tournament (IOI12_tournament)C++14
0 / 100
1068 ms3080 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int RT[4000005]; vector<int> V; int a,b; int ans[4000005]; int converti(int k){ int res=0; for(int i=0;i<k;) if(RT[res++]) i++; return res; } void elimina(int a, int b){ for(int i=a;i<=b;i++) RT[i]=0; } int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { for(int i=0;i<400005;i++) RT[i]=1; for(int i=0;i<C;i++){ S[i]=converti(S[i]); E[i]++; E[i]=converti(E[i]); elimina(S[i]+1,E[i]); } for(int pos=0;pos<N;pos++){ V.clear(); for(int i=0;i<N;i++){ if(pos==i) V.push_back(R); if(i!=N-1) V.push_back(K[i]); } for(a=pos;a>=0 and V[a]<=R;a--); a++; for(b=pos;b<N and V[b]<=R;b++); for(int i=0;i<C;i++){ //cout<<a<<" "<<b<<" "<<S[i]<<" "<<E[i]<<" "<<pos<<endl; if(a<=S[i] and E[i]<=b and S[i]<=pos and pos<E[i]) ans[pos]++; } //cout<<"ans "<<ans[pos]<<endl; } return max_element(ans,ans+N)-ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...