Submission #348343

# Submission time Handle Problem Language Result Execution time Memory
348343 2021-01-14T17:03:56 Z Mefarnis Archery (IOI09_archery) C++14
10 / 100
2000 ms 65540 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define maxn 200000
#define pb push_back
using namespace std;
typedef pair<int,int> pi;

int n,k;
int ar[2*maxn];
int ansLast,ansInit;
vector< vector<pi> > v;

int main() {
	scanf("%d%d",&n,&k);
	for( int i = 0 ; i < 2*n ; i++ )
		scanf("%d",&ar[i]);
	ansLast = n;
	for( int t = 0 ; t < n ; t++ ) {
		v.clear();
		vector<pi> vec;
		for( int i = 0 ; i < n ; i++ )
			vec.pb(pi(0,0));
		vec[t].fi = ar[0];
		for( int i = 1 , idx = 0 ; i < 2*n ; i++ ) {
			if(vec[idx].fi == 0)
				vec[idx].fi = ar[i];
			else
				vec[idx++].se = ar[i];
		}
		v.pb(vec);
		for( int r = 1 ; r <= k ; r++ ) {
			for( int i = 0 ; i < n ; i++ )
				vec[i] = pi(0,0);
			for( int i = 1 ; i < n ; i++ ) {
				vec[i-1].fi = min(v[r-1][i].fi,v[r-1][i].se);
				vec[i].se = max(v[r-1][i].fi,v[r-1][i].se);
			}
			vec[0].se = min(v[r-1][0].fi,v[r-1][0].se);
			vec[n-1].fi = max(v[r-1][0].fi,v[r-1][0].se);
			v.pb(vec);
		}
		for( int i = 0 ; i < n ; i++ )
			if(v[k][i].fi == ar[0] || v[k][i].se == ar[0]) {
				if(i <= ansLast) {
					ansLast = i;
					ansInit = t;
				}
				break;
			}
	}
	printf("%d\n",ansInit+1);
	return 0;
}

Compilation message

archery.cpp: In function 'int main()':
archery.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |  scanf("%d%d",&n,&k);
      |  ~~~~~^~~~~~~~~~~~~~
archery.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |   scanf("%d",&ar[i]);
      |   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Runtime error 74 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 77 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 70 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Correct 2 ms 512 KB Output is correct
6 Runtime error 76 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Correct 4 ms 492 KB Output is correct
2 Runtime error 72 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 74 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 76 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 120 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 73 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Execution timed out 2091 ms 27592 KB Time limit exceeded
8 Runtime error 69 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 74 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 68 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 72 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Runtime error 70 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Runtime error 101 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
14 Runtime error 70 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
15 Runtime error 82 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Correct 202 ms 1832 KB Output is correct
17 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
18 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
20 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
21 Runtime error 74 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
22 Runtime error 80 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
23 Runtime error 117 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
24 Correct 101 ms 1368 KB Output is correct
25 Runtime error 74 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
26 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
27 Runtime error 76 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
28 Runtime error 106 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
29 Runtime error 72 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
30 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
31 Runtime error 76 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
32 Runtime error 117 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
33 Correct 136 ms 1556 KB Output is correct
34 Runtime error 75 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
35 Runtime error 70 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
36 Runtime error 67 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
37 Runtime error 74 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Runtime error 76 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
39 Runtime error 72 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
40 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
41 Runtime error 70 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
42 Runtime error 71 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
43 Runtime error 70 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
44 Runtime error 73 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
45 Runtime error 78 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
46 Runtime error 83 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
47 Runtime error 121 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)