답안 #271087

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
271087 2020-08-18T04:41:19 Z 임성재(#5104) Archery (IOI09_archery) C++17
20 / 100
74 ms 6264 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[211];

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) {
				//cout << i << " " << j << endl;
				if(j <= mn) {
					mn = j;
					mni = i;
				}
				break;
			}
		}
	}

	cout << mni;
}

Compilation message

archery.cpp: In function 'int main()':
archery.cpp:71:10: warning: 'mni' may be used uninitialized in this function [-Wmaybe-uninitialized]
   71 |  cout << mni;
      |          ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Runtime error 2 ms 640 KB Execution killed with signal 11
3 Correct 9 ms 384 KB Output is correct
4 Runtime error 2 ms 512 KB Execution killed with signal 11
5 Correct 1 ms 384 KB Output is correct
6 Correct 57 ms 360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 71 ms 408 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11
4 Runtime error 5 ms 928 KB Execution killed with signal 11
5 Runtime error 38 ms 5368 KB Execution killed with signal 11
6 Correct 61 ms 384 KB Output is correct
7 Runtime error 1 ms 512 KB Execution killed with signal 11
8 Runtime error 4 ms 896 KB Execution killed with signal 11
9 Runtime error 5 ms 1024 KB Execution killed with signal 11
10 Runtime error 1 ms 512 KB Execution killed with signal 11
11 Runtime error 5 ms 1152 KB Execution killed with signal 11
12 Runtime error 2 ms 588 KB Execution killed with signal 11
13 Runtime error 25 ms 4096 KB Execution killed with signal 11
14 Runtime error 2 ms 640 KB Execution killed with signal 11
15 Runtime error 7 ms 1408 KB Execution killed with signal 11
16 Correct 70 ms 408 KB Output is correct
17 Runtime error 1 ms 512 KB Execution killed with signal 11
18 Runtime error 2 ms 512 KB Execution killed with signal 11
19 Runtime error 2 ms 640 KB Execution killed with signal 11
20 Runtime error 2 ms 640 KB Execution killed with signal 11
21 Runtime error 5 ms 1152 KB Execution killed with signal 11
22 Runtime error 7 ms 1280 KB Execution killed with signal 11
23 Runtime error 38 ms 5624 KB Execution killed with signal 11
24 Correct 72 ms 384 KB Output is correct
25 Runtime error 2 ms 616 KB Execution killed with signal 11
26 Runtime error 2 ms 640 KB Execution killed with signal 11
27 Runtime error 5 ms 1152 KB Execution killed with signal 11
28 Runtime error 29 ms 4352 KB Execution killed with signal 11
29 Runtime error 1 ms 512 KB Execution killed with signal 11
30 Runtime error 3 ms 640 KB Execution killed with signal 11
31 Runtime error 5 ms 1024 KB Execution killed with signal 11
32 Runtime error 38 ms 5592 KB Execution killed with signal 11
33 Correct 74 ms 384 KB Output is correct
34 Correct 65 ms 384 KB Output is correct
35 Runtime error 2 ms 512 KB Execution killed with signal 11
36 Runtime error 2 ms 640 KB Execution killed with signal 11
37 Runtime error 5 ms 1024 KB Execution killed with signal 11
38 Runtime error 6 ms 1152 KB Execution killed with signal 11
39 Correct 60 ms 384 KB Output is correct
40 Runtime error 1 ms 512 KB Execution killed with signal 11
41 Runtime error 2 ms 640 KB Execution killed with signal 11
42 Runtime error 2 ms 640 KB Execution killed with signal 11
43 Runtime error 2 ms 640 KB Execution killed with signal 11
44 Runtime error 4 ms 768 KB Execution killed with signal 11
45 Runtime error 6 ms 1024 KB Execution killed with signal 11
46 Runtime error 7 ms 1152 KB Execution killed with signal 11
47 Runtime error 43 ms 6264 KB Execution killed with signal 11