Submission #58995

# Submission time Handle Problem Language Result Execution time Memory
58995 2018-07-20T01:59:05 Z tugushka The Big Prize (IOI17_prize) C++14
20 / 100
99 ms 1764 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;

vector < int > res, a;
map < int, vector < int > > x;
map < int , int > cnt;
int sq, mx;

int find_best(int n){
	int now = 0;
	
	for( ; now < min(sq+30, n-1) ; now++ ){
		res = ask(now);
		x[now] = res;
		cnt[res[0]+res[1]]++;
		mx = max( res[0]+res[1], mx );
		if( res[0] == 0 && res[1] == 0 ) return now;
	}
	
	int low = 0;
	for( map < int, int > :: iterator it = cnt.begin() ; it != cnt.end() ; it++ ){
		if( it -> first != mx ) low += it->second;
	}
	
	while( 1 ){
		if( x[now].empty() ) res = ask(now);
		else res = x[now];
		x[now] = res;
		mx = max(mx, res[0]+res[1]);
		if( res[0] == 0 && res[1] == 0 ) return now;
		
		if( res[0]+res[1] == mx ){
			int l = now, r = min(n-1, now + (n-now)/(mx-low+1));
			while( l < r ){
				int mid = (l+r+1)/2;
				if( x[mid].empty() )
					a = ask(mid),
					x[mid] = a;
				else a = x[mid];
				
				if( !a[0] && !a[1] ) return mid;
				
				if( res[0] == a[0] && res[1] == a[1] )
					l = mid;
				else r = mid-1;
			}
			now = l+1;
		}
		else now++, low++;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 2 ms 436 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 3 ms 436 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 536 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 544 KB Output is correct
10 Correct 3 ms 548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 548 KB Output is correct
2 Correct 2 ms 564 KB Output is correct
3 Correct 3 ms 564 KB Output is correct
4 Correct 3 ms 572 KB Output is correct
5 Correct 2 ms 572 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 3 ms 572 KB Output is correct
9 Correct 2 ms 572 KB Output is correct
10 Correct 3 ms 572 KB Output is correct
11 Correct 4 ms 572 KB Output is correct
12 Correct 2 ms 572 KB Output is correct
13 Correct 4 ms 592 KB Output is correct
14 Correct 5 ms 592 KB Output is correct
15 Correct 8 ms 592 KB Output is correct
16 Correct 18 ms 1068 KB Output is correct
17 Correct 2 ms 1068 KB Output is correct
18 Correct 50 ms 1068 KB Output is correct
19 Correct 3 ms 1068 KB Output is correct
20 Correct 19 ms 1068 KB Output is correct
21 Correct 10 ms 1068 KB Output is correct
22 Correct 8 ms 1068 KB Output is correct
23 Correct 3 ms 1068 KB Output is correct
24 Correct 3 ms 1068 KB Output is correct
25 Correct 41 ms 1068 KB Output is correct
26 Correct 40 ms 1068 KB Output is correct
27 Correct 4 ms 1068 KB Output is correct
28 Partially correct 75 ms 1308 KB Partially correct - number of queries: 6987
29 Partially correct 55 ms 1308 KB Partially correct - number of queries: 5251
30 Correct 39 ms 1308 KB Output is correct
31 Correct 2 ms 1308 KB Output is correct
32 Correct 5 ms 1308 KB Output is correct
33 Correct 2 ms 1308 KB Output is correct
34 Correct 15 ms 1308 KB Output is correct
35 Correct 5 ms 1308 KB Output is correct
36 Correct 9 ms 1308 KB Output is correct
37 Correct 3 ms 1308 KB Output is correct
38 Correct 3 ms 1308 KB Output is correct
39 Correct 12 ms 1308 KB Output is correct
40 Correct 46 ms 1308 KB Output is correct
41 Correct 22 ms 1308 KB Output is correct
42 Correct 39 ms 1308 KB Output is correct
43 Correct 31 ms 1308 KB Output is correct
44 Correct 14 ms 1308 KB Output is correct
45 Correct 28 ms 1308 KB Output is correct
46 Correct 2 ms 1308 KB Output is correct
47 Correct 33 ms 1308 KB Output is correct
48 Correct 41 ms 1308 KB Output is correct
49 Correct 8 ms 1308 KB Output is correct
50 Correct 58 ms 1308 KB Output is correct
51 Correct 16 ms 1308 KB Output is correct
52 Correct 3 ms 1308 KB Output is correct
53 Correct 4 ms 1308 KB Output is correct
54 Correct 23 ms 1308 KB Output is correct
55 Correct 4 ms 1308 KB Output is correct
56 Correct 47 ms 1308 KB Output is correct
57 Correct 35 ms 1308 KB Output is correct
58 Correct 24 ms 1308 KB Output is correct
59 Correct 25 ms 1308 KB Output is correct
60 Correct 22 ms 1308 KB Output is correct
61 Correct 3 ms 1308 KB Output is correct
62 Correct 3 ms 1308 KB Output is correct
63 Correct 4 ms 1308 KB Output is correct
64 Correct 3 ms 1308 KB Output is correct
65 Correct 11 ms 1308 KB Output is correct
66 Incorrect 99 ms 1764 KB Incorrect
67 Halted 0 ms 0 KB -