Submission #988934

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9889342024-05-27 04:08:03PenguinsAreCuteArchery (IOI09_archery)C++17
20 / 100
2102 ms9040 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int> comp_pos(int N, int R, vector<int> A) {
R=2*N+(R%N);
for(int i=0;i<R;i++) {
for(int j=0;j<N;j++) if(A[j<<1]>A[j<<1|1]) swap(A[j<<1],A[j<<1|1]);
int wtf = A[1];
A[1] = A[2];
for(int i=2;i<2*N-2;i+=2) A[i]=A[i+2];
A[2*N-2]=wtf;
}
return A;
}
main() {
int N, R; cin >> N >> R;
vector<int> A(2*N); for(int i=0;i<2*N;i++) cin>>A[i];
pair<int,int> best = {5e5,0};
for(int i=1;i<2*N;i++) {
swap(A[i-1],A[i]);
vector<int> u = comp_pos(N,R,A);
for(int j=0;j<2*N;j++) if(u[j]==A[i]) best=min(best,{j>>1,-(i>>1)});
}
cout << 1-best.second;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

archery.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...