Submission #315684

#TimeUsernameProblemLanguageResultExecution timeMemory
315684juggernautJousting tournament (IOI12_tournament)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#include"grader.cpp" #ifdef EVAL #else #include"grader.cpp" #endif using namespace std; int a[5005],N,tree[20005],flag[20005]; int gt(int v,int l,int r,int ql,int qr){ int val=0; for(int i=ql;i<=qr;i++)val=a[i],val); return val; } void upd(int v,int l,int r,int ql,int qr,int val){ for(int i=ql;i<=qr;i++)a[i]=val; } int GetBestPosition(int n,int C,int R,int *K,int *s,int *e){ N=n; vector<int>S,E,v; for(int i=0;i<N-1;i++)K[i]=(K[i]>R); for(int i=0;i<N;i++)v.push_back(i); for(int i=0;i<C;i++){ S.push_back(v[s[i]]); E.push_back(v[e[i]]); vector<int>temp; for(int j=0;j<v.size();j++)if(!(s[i]<j&&j<=e[i]))temp.push_back(v[j]); v.clear(); v.insert(v.end(),temp.begin(),temp.end()); } int mx=-1,cnt,id; for(int pos=0;pos<N;pos++){ for(int i=0;i<pos;i++)a[i]=K[i]; a[pos]=R; for(int i=pos+1;i<N;i++)a[i]=K[i-1]; cnt=0; for(int i=0;i<C;i++){ int tmp=gt(1,0,N-1,S[i],E[i]); if(tmp==0)cnt++; else{ upd(1,0,N-1,S[i],S[i],1); upd(1,0,N-1,E[i],E[i],1); } } if(cnt>mx){ mx=cnt; id=pos; } } for(int i=0;i<C;i++) for(int j=i+1;j<C;j++)if(S[i]<=S[j]&&E[j]<=E[i])exit(-1); return id; } /* 5 3 3 1 0 2 4 1 3 0 1 0 1 */

Compilation message (stderr)

tournament.cpp: In function 'int gt(int, int, int, int, int)':
tournament.cpp:11:40: error: expected ';' before ')' token
   11 |     for(int i=ql;i<=qr;i++)val=a[i],val);
      |                                        ^
      |                                        ;
tournament.cpp:11:41: warning: right operand of comma operator has no effect [-Wunused-value]
   11 |     for(int i=ql;i<=qr;i++)val=a[i],val);
      |                                         ^
tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int j=0;j<v.size();j++)if(!(s[i]<j&&j<=e[i]))temp.push_back(v[j]);
      |                     ~^~~~~~~~~