# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
270456 | gs14004 | Archery (IOI09_archery) | C++17 | 2095 ms | 1024 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 10005;
const int mod = 1e9 + 7;
int n, r, a[MAXN], b[MAXN];
int Do(int r, int s){
for(int i=0; i<r; i++){
for(int j=0; j<n; j++){
if(a[j] > a[j+n]) swap(a[j], a[j+n]);
}
swap(a[0], a[n]);
rotate(a, a + 1, a + n);
}
int pos = (find(a, a + 2 * n, s) - a);
return pos % n;
}
int main(){
scanf("%d %d",&n,&r);
for(int i=0; i<2*n; i++){
scanf("%d",&b[i]);
}
r = (r % (2 * n)) + 2 * n;
pi ret(1e9, 1e9);
for(int i=0; i<n; i++){
vector<int> foo(b, b + 2 * n);
rotate(foo.begin(), foo.begin() + 1, foo.begin() + 2 * i + 1);
for(int i=0; i<n; i++){
a[i] = foo[2*i];
a[i+n] = foo[2*i+1];
}
ret = min(ret, pi(Do(r, b[0]), -i));
}
cout << 1-ret.second << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |