Submission #69820

#TimeUsernameProblemLanguageResultExecution timeMemory
69820FedericoSJousting tournament (IOI12_tournament)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <assert.h> using namespace std; typedef pair<int,int> pii; int RT[4000005]; vector<int> V; int a,b; pii ans,res; int converti(int k){ int res=0; for(int i=0;i<k+1;) if(RT[res++]) i++; return res-1; } void elimina(int x, int y){ for(int i=x;i<=y;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]=converti(E[i]); elimina(S[i]+1,E[i]); //for(int i=0;i<10;i++)cout<<RT[i]<<" ";cout<<endl; } //for(int i=0;i<C;i++)cout<<S[i]<<" "<<E[i]<<endl; 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]); } res={0,-pos}; for(a=pos;a>=0 and V[a]<=R;a--); a++; for(b=pos;b<N and V[b]<=R;b++); b--; assert(a==0 or V[a]>R); assert(B==N-1 or V[b]>R); 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]) res.first++; } //cout<<res.first<<" "<<res.second<<endl; ans=max(ans,res); } return -ans.second; } /* 5 3 5 1 2 3 4 0 2 1 3 1 2 */

Compilation message (stderr)

In file included from tournament.cpp:3:0:
tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:57:10: error: 'B' was not declared in this scope
   assert(B==N-1 or V[b]>R);
          ^