Submission #271991

# Submission time Handle Problem Language Result Execution time Memory
271991 2020-08-18T08:17:03 Z 임성재(#5104) Archery (IOI09_archery) C++17
20 / 100
2000 ms 3832 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
const ll Mod = 1e9 + 7;

int n, r, p;
int a[400010];
vector<int> v[5010];

int main() {
	fast;

	cin >> n >> r;
	cin >> p;

	for(int i=1; i<2*n; i++) {
		cin >> a[i];
	}

	int mn = inf, mni;

	for(int i=1; i<=n; i++) {
		for(int j=1; j<=n; j++) v[j].clear();

		v[i].eb(p);

		int idx = 1;

		for(int j=1; j<2*n; j++) {
			if(v[idx].size() == 2) idx++;
			v[idx].eb(a[j]);
		}

		r = 2*n + r % n;

		for(int j=1; j<=r; j++) {
			if(v[1][0] > v[1][1]) swap(v[1][0], v[1][1]);

			for(int k=2; k<=n; k++) {
				if(v[k][0] < v[k][1]) swap(v[k][0], v[k][1]);

				swap(v[k-1][1], v[k][1]);
			}
		}

		for(int j=1; j<=n; j++) {
			if(v[j][0] == p || v[j][1] == p) {
				if(j <= mn) {
					mn = j;
					mni = i;
				}
				break;
			}
		}
	}

	cout << mni;
}

Compilation message

archery.cpp: In function 'int main()':
archery.cpp:70:10: warning: 'mni' may be used uninitialized in this function [-Wmaybe-uninitialized]
   70 |  cout << mni;
      |          ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Execution timed out 2017 ms 512 KB Time limit exceeded
3 Correct 10 ms 512 KB Output is correct
4 Execution timed out 2079 ms 512 KB Time limit exceeded
5 Correct 1 ms 512 KB Output is correct
6 Correct 56 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 512 KB Output is correct
2 Correct 72 ms 512 KB Output is correct
3 Execution timed out 2071 ms 512 KB Time limit exceeded
4 Runtime error 5 ms 1280 KB Execution killed with signal 11
5 Runtime error 36 ms 3448 KB Execution killed with signal 11
6 Correct 58 ms 512 KB Output is correct
7 Execution timed out 2073 ms 512 KB Time limit exceeded
8 Runtime error 5 ms 1280 KB Execution killed with signal 11
9 Runtime error 6 ms 1408 KB Execution killed with signal 11
10 Execution timed out 2076 ms 512 KB Time limit exceeded
11 Runtime error 6 ms 1408 KB Execution killed with signal 11
12 Execution timed out 2076 ms 512 KB Time limit exceeded
13 Runtime error 26 ms 2688 KB Execution killed with signal 11
14 Execution timed out 2039 ms 640 KB Time limit exceeded
15 Runtime error 10 ms 1536 KB Execution killed with signal 11
16 Correct 71 ms 512 KB Output is correct
17 Execution timed out 2083 ms 512 KB Time limit exceeded
18 Execution timed out 2088 ms 512 KB Time limit exceeded
19 Execution timed out 2091 ms 640 KB Time limit exceeded
20 Execution timed out 2099 ms 640 KB Time limit exceeded
21 Runtime error 7 ms 1408 KB Execution killed with signal 11
22 Runtime error 8 ms 1536 KB Execution killed with signal 11
23 Runtime error 38 ms 3576 KB Execution killed with signal 11
24 Correct 69 ms 512 KB Output is correct
25 Execution timed out 2081 ms 512 KB Time limit exceeded
26 Execution timed out 2067 ms 640 KB Time limit exceeded
27 Runtime error 6 ms 1408 KB Execution killed with signal 11
28 Runtime error 30 ms 2792 KB Execution killed with signal 11
29 Execution timed out 2080 ms 512 KB Time limit exceeded
30 Execution timed out 2062 ms 640 KB Time limit exceeded
31 Runtime error 6 ms 1408 KB Execution killed with signal 11
32 Runtime error 37 ms 3456 KB Execution killed with signal 11
33 Correct 72 ms 512 KB Output is correct
34 Correct 61 ms 512 KB Output is correct
35 Execution timed out 2016 ms 512 KB Time limit exceeded
36 Execution timed out 2085 ms 512 KB Time limit exceeded
37 Runtime error 7 ms 1280 KB Execution killed with signal 11
38 Runtime error 7 ms 1408 KB Execution killed with signal 11
39 Correct 62 ms 512 KB Output is correct
40 Execution timed out 2075 ms 512 KB Time limit exceeded
41 Execution timed out 2096 ms 512 KB Time limit exceeded
42 Execution timed out 2047 ms 512 KB Time limit exceeded
43 Execution timed out 2070 ms 640 KB Time limit exceeded
44 Runtime error 4 ms 1152 KB Execution killed with signal 11
45 Runtime error 6 ms 1408 KB Execution killed with signal 11
46 Runtime error 7 ms 1408 KB Execution killed with signal 11
47 Runtime error 41 ms 3832 KB Execution killed with signal 11