Submission #1067977

#TimeUsernameProblemLanguageResultExecution timeMemory
1067977kunzaZa183Archery (IOI09_archery)C++17
20 / 100
1519 ms6176 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int n,rd; cin>>n>>rd; rd-= 2*n; int skill; cin>>skill; vector<int> vi; for(int i =0 ;i < 2*n-1;i++) { int x; cin>>x; vi.push_back(x); } vector<int> contest[200]; for(int i = 0; i < n;i++) contest[i] = vector<int>(2); int minplace = 1e9,maxst = 0; for(int i = 0; i < 2*n;i++) { vector<int> vi2(vi); vi2.insert(vi2.begin() + i,skill); for(int j =0; j < n;j++) contest[j][0] = vi2[j*2],contest[j][1] = vi2[j*2 + 1]; for(int k = 0 ;k < n * 2;k++) { vector<int> contest2[200]; for(int j =0 ; j < n;j++) { if(contest[j][0]>contest[j][1]) swap(contest[j][0], contest[j][1]); if(j==0) { contest2[j].push_back(contest[j][0]); contest2[n-1].push_back(contest[j][1]); } else { contest2[j].push_back(contest[j][1]); contest2[j-1].push_back(contest[j][0]); } } // for(int j = 0; j < n;j++) // cout<<contest2[j][0]<<" "<<contest2[j][1]<<" "; // cout<<"\n"; for(int j = 0; j < n;j++) contest[j] = contest2[j]; } for(int j = 0; j < n;j++) if(contest[j][0] > contest[j][1]) swap(contest[j][0],contest[j][1]); int in; for(int j =0 ; j < n;j++) if(contest[j][0] == skill || contest[j][1] == skill) in = j; int endup; if(skill ==1 || skill > n ){ endup = in; } else { endup = (in - rd %n + n) % n; } // cout<<i<<" "<<endup<<"\n"; if(endup <= minplace) { maxst = i/2 + 1; minplace = endup; } } cout<<maxst<<"\n"; }

Compilation message (stderr)

archery.cpp: In function 'int main()':
archery.cpp:64:19: warning: 'in' may be used uninitialized in this function [-Wmaybe-uninitialized]
   64 |       endup = (in - rd %n + n) % n;
      |                ~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...