Submission #348449

#TimeUsernameProblemLanguageResultExecution timeMemory
348449daniel920712Jousting tournament (IOI12_tournament)C++14
0 / 100
1099 ms3180 KiB
#include <stdio.h> #include <time.h> #include <iostream> #include <stdio.h> #include <assert.h> #include <vector> using namespace std; vector < int > all; vector < int > ttt; struct A { int l,r; int nxl,nxr; int con; }Node[200005]; int now; void build(int l,int r,int here) { Node[here].l=l; Node[here].r=r; Node[here].con=(r-l+1); if(l==r) return; Node[here].nxl=now++; Node[here].nxr=now++; build(l,(l+r)/2,Node[here].nxl); build((l+r)/2+1,r,Node[here].nxr); } int Find(int here,int con) { if(Node[here].l==Node[here].r) return Node[here].l; if(con<=Node[Node[here].nxl].con) return Find(Node[here].nxl,con); else return Find(Node[here].nxr,con-Node[Node[here].nxl].con); } void cha(int where,int here) { Node[here].con--; if(Node[here].l==Node[here].r) return; if(where<=(Node[here].l+Node[here].r)/2) cha(where,Node[here].nxl); else cha(where,Node[here].nxr); } int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { int ans=-1,where=-1,who,i,j,k,tt,big; for(i=0;i<N;i++) { tt=0; now=1; build(0,N-1,0); all.clear(); for(j=0;j<i;j++) all.push_back(K[i]); all.push_back(R); for(j=i;j<N-1;j++) all.push_back(K[i]); /*for(j=0;j<C;j++) { ttt.clear(); big=-1; for(k=S[i];k<=E[i];k++) { who=Find(0,k+1); big=max(big,all[who]); ttt.push_back(who); } if(big==R) tt++; for(auto k:ttt) if(all[k]!=big) cha(k,0); } if(tt>ans) { ans=tt; where=i; }*/ } return where; }

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:43:9: warning: unused variable 'ans' [-Wunused-variable]
   43 |     int ans=-1,where=-1,who,i,j,k,tt,big;
      |         ^~~
tournament.cpp:43:25: warning: unused variable 'who' [-Wunused-variable]
   43 |     int ans=-1,where=-1,who,i,j,k,tt,big;
      |                         ^~~
tournament.cpp:43:33: warning: unused variable 'k' [-Wunused-variable]
   43 |     int ans=-1,where=-1,who,i,j,k,tt,big;
      |                                 ^
tournament.cpp:43:35: warning: variable 'tt' set but not used [-Wunused-but-set-variable]
   43 |     int ans=-1,where=-1,who,i,j,k,tt,big;
      |                                   ^~
tournament.cpp:43:38: warning: unused variable 'big' [-Wunused-variable]
   43 |     int ans=-1,where=-1,who,i,j,k,tt,big;
      |                                      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...