Submission #975167

# Submission time Handle Problem Language Result Execution time Memory
975167 2024-05-04T14:14:36 Z StefanSebez The Big Prize (IOI17_prize) C++14
20 / 100
46 ms 3224 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
mt19937 rng(time(0));
int nekict=0;
int find_best(int n){
	pair<int,int> temp[n+10];
	for(int i=0;i<n;i++) temp[i].fi=temp[i].se=-1;
	int ct=150,V=n;
	while(ct--){
		int x=rng()%n;
		vector<int>tmp;
		if(temp[x].fi==-1) {tmp=ask(x);nekict++;}
		else tmp.pb(temp[x].fi),tmp.pb(temp[x].se);
		temp[x]={tmp[0],tmp[1]};
		if(n-(tmp[0]+tmp[1])<V) V=n-(tmp[0]+tmp[1]);
	}
	int res=-1;
	set<int>st;
	st.insert(-1),st.insert(n);
	auto it=st.begin();
	int sajz=0;
	while(it!=st.end()){
		if(nekict>=10000-10) break;
		auto it2=it;
		int i=*it;
		if(res!=-1 && res==i) break;
		it++;
		if(it==st.end()) break;
		int j=*it;
		int l=i+1,r=j-1;
		//printf("%i %i %i\n",i,j,sajz);
		while(l<=r){
			if(nekict>=10000-10) break;
			int mid=(l+r)/2;
			vector<int>tmp;
			if(temp[mid].fi==-1) {tmp=ask(mid);nekict++;}
			else tmp.pb(temp[mid].fi),tmp.pb(temp[mid].se);
			temp[mid]={tmp[0],tmp[1]};
			if(n-tmp[0]-tmp[1]!=V){
				if(tmp[0]==0 && tmp[1]==0) {res=mid;break;}
				st.insert(mid);
				r=mid-1;
				continue;
			}
			if(tmp[0]>=1+sajz) r=mid-1;
			else l=mid+1;
		}
		it=it2;
		it++;
		sajz++;
	}
	/*for(auto i=st.begin();i!=st.end();i++){
		int x=*i;
		if(x==-1 || x==n) continue;
		if(temp[x].fi==0 && temp[x].se==0) res=x;
	}*/
	//for(auto i=st.begin();i!=st.end();i++) printf("%i ",*i);
	//printf("\n");
	/*for(int i = 0; i < n; i++) {
		std::vector<int> res = ask(i);
		if(res[0] + res[1] == 0)
			return i;
	}*/
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1880 KB Output is correct
2 Correct 2 ms 1880 KB Output is correct
3 Correct 2 ms 1880 KB Output is correct
4 Correct 2 ms 1880 KB Output is correct
5 Correct 2 ms 1880 KB Output is correct
6 Correct 3 ms 1880 KB Output is correct
7 Correct 2 ms 1880 KB Output is correct
8 Correct 2 ms 1880 KB Output is correct
9 Correct 2 ms 1880 KB Output is correct
10 Correct 2 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1880 KB Output is correct
2 Correct 2 ms 1880 KB Output is correct
3 Correct 2 ms 1880 KB Output is correct
4 Correct 2 ms 1968 KB Output is correct
5 Correct 2 ms 1880 KB Output is correct
6 Correct 2 ms 1880 KB Output is correct
7 Correct 2 ms 1880 KB Output is correct
8 Correct 3 ms 1880 KB Output is correct
9 Correct 2 ms 1880 KB Output is correct
10 Correct 2 ms 1880 KB Output is correct
11 Correct 3 ms 1880 KB Output is correct
12 Correct 2 ms 1880 KB Output is correct
13 Correct 4 ms 1880 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 9 ms 2000 KB Output is correct
16 Partially correct 36 ms 2248 KB Partially correct - number of queries: 6646
17 Correct 2 ms 1880 KB Output is correct
18 Partially correct 31 ms 2252 KB Partially correct - number of queries: 7755
19 Correct 2 ms 1880 KB Output is correct
20 Correct 10 ms 1220 KB Output is correct
21 Correct 14 ms 2004 KB Output is correct
22 Correct 4 ms 1880 KB Output is correct
23 Correct 2 ms 1880 KB Output is correct
24 Correct 2 ms 1880 KB Output is correct
25 Correct 21 ms 2236 KB Output is correct
26 Correct 18 ms 2000 KB Output is correct
27 Correct 2 ms 1880 KB Output is correct
28 Partially correct 36 ms 2428 KB Partially correct - number of queries: 6510
29 Correct 17 ms 2260 KB Output is correct
30 Partially correct 38 ms 2000 KB Partially correct - number of queries: 7688
31 Correct 2 ms 1880 KB Output is correct
32 Correct 4 ms 1880 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 11 ms 2420 KB Output is correct
35 Correct 3 ms 2132 KB Output is correct
36 Correct 11 ms 2000 KB Output is correct
37 Correct 2 ms 1880 KB Output is correct
38 Correct 2 ms 1880 KB Output is correct
39 Correct 18 ms 2008 KB Output is correct
40 Partially correct 29 ms 2008 KB Partially correct - number of queries: 6603
41 Correct 24 ms 2244 KB Output is correct
42 Correct 24 ms 2172 KB Output is correct
43 Correct 24 ms 2008 KB Output is correct
44 Correct 13 ms 2004 KB Output is correct
45 Correct 14 ms 1996 KB Output is correct
46 Correct 2 ms 1880 KB Output is correct
47 Correct 21 ms 2000 KB Output is correct
48 Partially correct 26 ms 2004 KB Partially correct - number of queries: 5796
49 Correct 4 ms 1880 KB Output is correct
50 Partially correct 39 ms 2256 KB Partially correct - number of queries: 7743
51 Correct 13 ms 2008 KB Output is correct
52 Correct 2 ms 1880 KB Output is correct
53 Correct 3 ms 1880 KB Output is correct
54 Correct 18 ms 2004 KB Output is correct
55 Correct 2 ms 1880 KB Output is correct
56 Partially correct 37 ms 2000 KB Partially correct - number of queries: 7757
57 Partially correct 26 ms 2244 KB Partially correct - number of queries: 5661
58 Correct 18 ms 2268 KB Output is correct
59 Correct 31 ms 2008 KB Output is correct
60 Correct 17 ms 2012 KB Output is correct
61 Correct 3 ms 1880 KB Output is correct
62 Correct 2 ms 1880 KB Output is correct
63 Correct 2 ms 1880 KB Output is correct
64 Correct 2 ms 1880 KB Output is correct
65 Correct 3 ms 1880 KB Output is correct
66 Correct 4 ms 2016 KB Output is correct
67 Correct 4 ms 2020 KB Output is correct
68 Correct 4 ms 2264 KB Output is correct
69 Correct 3 ms 2020 KB Output is correct
70 Correct 3 ms 2012 KB Output is correct
71 Partially correct 37 ms 2004 KB Partially correct - number of queries: 7992
72 Correct 4 ms 1880 KB Output is correct
73 Partially correct 41 ms 2256 KB Partially correct - number of queries: 7878
74 Partially correct 37 ms 2016 KB Partially correct - number of queries: 7915
75 Correct 3 ms 1880 KB Output is correct
76 Partially correct 30 ms 2232 KB Partially correct - number of queries: 6804
77 Partially correct 43 ms 2252 KB Partially correct - number of queries: 7388
78 Correct 4 ms 1880 KB Output is correct
79 Correct 16 ms 2008 KB Output is correct
80 Partially correct 40 ms 2504 KB Partially correct - number of queries: 7773
81 Partially correct 36 ms 2512 KB Partially correct - number of queries: 7166
82 Partially correct 37 ms 2264 KB Partially correct - number of queries: 6987
83 Correct 2 ms 1880 KB Output is correct
84 Partially correct 28 ms 2256 KB Partially correct - number of queries: 6205
85 Partially correct 41 ms 2012 KB Partially correct - number of queries: 7436
86 Correct 18 ms 2516 KB Output is correct
87 Correct 5 ms 1880 KB Output is correct
88 Correct 22 ms 2268 KB Output is correct
89 Correct 22 ms 2256 KB Output is correct
90 Correct 2 ms 2132 KB Output is correct
91 Correct 17 ms 2640 KB Output is correct
92 Correct 17 ms 2008 KB Output is correct
93 Incorrect 46 ms 3224 KB Integer -1 violates the range [0, 199999]
94 Halted 0 ms 0 KB -