# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
252337 | 2020-07-25T10:07:01 Z | SamAnd | Archery (IOI09_archery) | C++17 | 2000 ms | 7672 KB |
#include <bits/stdc++.h> using namespace std; #define m_p make_pair const int N = 400005; int n, r; int a[N]; pair<int, int> b[N], bb[N]; void solv1() { int ans1 = N, ans2; for (int u = n; u >= 1; --u) { int k = 0; for (int i = 2; i < u * 2; i += 2) b[++k] = m_p(a[i], a[i + 1]); b[++k] = m_p(0, a[u * 2]); for (int i = u * 2 + 1; i <= n * 2; i += 2) b[++k] = m_p(a[i], a[i + 1]); for (int j = 1; j <= 2 * n; ++j) { for (int i = 1; i <= n; ++i) { if (b[i].first > b[i].second) { if (i == 1) { bb[i].second = b[i].first; bb[n].first = b[i].second; } else { bb[i - 1].first = b[i].first; bb[i].second = b[i].second; } } else { if (i == 1) { bb[i].second = b[i].second; bb[n].first = b[i].first; } else { bb[i - 1].first = b[i].second; bb[i].second = b[i].first; } } } for (int i = 1; i <= n; ++i) b[i] = bb[i]; } int t = 0; for (int i = 1; i <= n; ++i) { if (b[i].second == 0) { t = i; break; } } if (!t) { for (int i = 1; i <= n; ++i) { if (b[i].first == 0) { t = (i - 1 - (r - n * 2) % n + n) % n; ++t; break; } } } if (t < ans1) { ans1 = t; ans2 = u; } if (ans1 == 1) break; } printf("%d\n", ans2); } int main() { scanf("%d%d", &n, &r); for (int i = 1; i <= n * 2; ++i) scanf("%d", &a[i]); if (a[1] == 1) { printf("%d\n", n * 2); return 0; } if (a[1] == n * 2) { printf("%d\n", 2); return 0; } for (int i = 2; i <= n * 2; ++i) { if (a[i] < a[1]) a[i] = 1; else a[i] = -1; } a[1] = 0; solv1(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 512 KB | Output isn't correct |
2 | Incorrect | 1 ms | 384 KB | Output isn't correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Execution timed out | 2083 ms | 384 KB | Time limit exceeded |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 35 ms | 384 KB | Output is correct |
3 | Execution timed out | 2077 ms | 384 KB | Time limit exceeded |
4 | Execution timed out | 2084 ms | 896 KB | Time limit exceeded |
5 | Execution timed out | 2080 ms | 6520 KB | Time limit exceeded |
6 | Correct | 35 ms | 384 KB | Output is correct |
7 | Execution timed out | 2080 ms | 384 KB | Time limit exceeded |
8 | Execution timed out | 2086 ms | 896 KB | Time limit exceeded |
9 | Execution timed out | 2081 ms | 1024 KB | Time limit exceeded |
10 | Execution timed out | 2086 ms | 384 KB | Time limit exceeded |
11 | Execution timed out | 2090 ms | 1024 KB | Time limit exceeded |
12 | Execution timed out | 2091 ms | 384 KB | Time limit exceeded |
13 | Execution timed out | 2074 ms | 4760 KB | Time limit exceeded |
14 | Execution timed out | 2076 ms | 512 KB | Time limit exceeded |
15 | Execution timed out | 2082 ms | 1408 KB | Time limit exceeded |
16 | Correct | 34 ms | 384 KB | Output is correct |
17 | Execution timed out | 2084 ms | 384 KB | Time limit exceeded |
18 | Execution timed out | 2097 ms | 384 KB | Time limit exceeded |
19 | Execution timed out | 2086 ms | 384 KB | Time limit exceeded |
20 | Execution timed out | 2086 ms | 512 KB | Time limit exceeded |
21 | Execution timed out | 2069 ms | 1024 KB | Time limit exceeded |
22 | Execution timed out | 2056 ms | 1448 KB | Time limit exceeded |
23 | Execution timed out | 2091 ms | 6904 KB | Time limit exceeded |
24 | Correct | 35 ms | 504 KB | Output is correct |
25 | Execution timed out | 2077 ms | 384 KB | Time limit exceeded |
26 | Execution timed out | 2065 ms | 512 KB | Time limit exceeded |
27 | Execution timed out | 2076 ms | 1024 KB | Time limit exceeded |
28 | Execution timed out | 2079 ms | 4984 KB | Time limit exceeded |
29 | Execution timed out | 2078 ms | 384 KB | Time limit exceeded |
30 | Execution timed out | 2078 ms | 512 KB | Time limit exceeded |
31 | Execution timed out | 2045 ms | 1024 KB | Time limit exceeded |
32 | Execution timed out | 2083 ms | 6776 KB | Time limit exceeded |
33 | Correct | 36 ms | 384 KB | Output is correct |
34 | Correct | 35 ms | 384 KB | Output is correct |
35 | Execution timed out | 2085 ms | 384 KB | Time limit exceeded |
36 | Execution timed out | 2090 ms | 384 KB | Time limit exceeded |
37 | Execution timed out | 2090 ms | 896 KB | Time limit exceeded |
38 | Execution timed out | 2085 ms | 1152 KB | Time limit exceeded |
39 | Correct | 28 ms | 384 KB | Output is correct |
40 | Execution timed out | 2079 ms | 384 KB | Time limit exceeded |
41 | Execution timed out | 2083 ms | 384 KB | Time limit exceeded |
42 | Execution timed out | 2089 ms | 384 KB | Time limit exceeded |
43 | Execution timed out | 2045 ms | 512 KB | Time limit exceeded |
44 | Execution timed out | 2071 ms | 640 KB | Time limit exceeded |
45 | Execution timed out | 2088 ms | 1024 KB | Time limit exceeded |
46 | Execution timed out | 2089 ms | 1024 KB | Time limit exceeded |
47 | Execution timed out | 2090 ms | 7672 KB | Time limit exceeded |