답안 #975152

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975152 2024-05-04T13:50:41 Z StefanSebez 커다란 상품 (IOI17_prize) C++14
20 / 100
51 ms 1932 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
mt19937 rng(time(0));
int find_best(int n){
	int ct=150,V=n;
	while(ct--){
		int x=rng()%n;
		vector<int>tmp=ask(x);
		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()){
		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){
			int mid=(l+r)/2;
			vector<int>tmp=ask(mid);
			if(n-tmp[0]-tmp[1]!=V){
				if(tmp[0]==0 && tmp[1]==0) res=mid;
				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++) 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 9 ms 696 KB Output is correct
15 Partially correct 48 ms 680 KB Partially correct - number of queries: 7417
16 Partially correct 29 ms 696 KB Partially correct - number of queries: 7815
17 Partially correct 44 ms 436 KB Partially correct - number of queries: 7828
18 Partially correct 37 ms 928 KB Partially correct - number of queries: 7828
19 Partially correct 33 ms 944 KB Partially correct - number of queries: 7334
20 Partially correct 22 ms 444 KB Partially correct - number of queries: 5094
21 Partially correct 35 ms 940 KB Partially correct - number of queries: 6637
22 Partially correct 26 ms 676 KB Partially correct - number of queries: 5551
23 Correct 1 ms 344 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Partially correct 45 ms 696 KB Partially correct - number of queries: 7206
26 Partially correct 36 ms 700 KB Partially correct - number of queries: 7517
27 Correct 1 ms 344 KB Output is correct
28 Partially correct 30 ms 684 KB Partially correct - number of queries: 6842
29 Partially correct 32 ms 444 KB Partially correct - number of queries: 5623
30 Partially correct 32 ms 936 KB Partially correct - number of queries: 7753
31 Partially correct 41 ms 444 KB Partially correct - number of queries: 7744
32 Correct 4 ms 344 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Partially correct 38 ms 680 KB Partially correct - number of queries: 7261
35 Correct 2 ms 600 KB Output is correct
36 Partially correct 33 ms 692 KB Partially correct - number of queries: 7143
37 Correct 3 ms 340 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Partially correct 33 ms 680 KB Partially correct - number of queries: 7748
40 Partially correct 26 ms 696 KB Partially correct - number of queries: 6650
41 Partially correct 33 ms 936 KB Partially correct - number of queries: 7568
42 Partially correct 37 ms 688 KB Partially correct - number of queries: 7568
43 Partially correct 28 ms 448 KB Partially correct - number of queries: 6957
44 Partially correct 29 ms 692 KB Partially correct - number of queries: 7203
45 Partially correct 32 ms 448 KB Partially correct - number of queries: 7456
46 Partially correct 38 ms 700 KB Partially correct - number of queries: 7841
47 Partially correct 33 ms 688 KB Partially correct - number of queries: 7298
48 Partially correct 38 ms 940 KB Partially correct - number of queries: 7822
49 Partially correct 31 ms 444 KB Partially correct - number of queries: 7448
50 Partially correct 39 ms 596 KB Partially correct - number of queries: 7822
51 Partially correct 34 ms 436 KB Partially correct - number of queries: 7137
52 Partially correct 46 ms 436 KB Partially correct - number of queries: 7822
53 Correct 1 ms 344 KB Output is correct
54 Partially correct 33 ms 700 KB Partially correct - number of queries: 7677
55 Partially correct 31 ms 448 KB Partially correct - number of queries: 7820
56 Partially correct 37 ms 936 KB Partially correct - number of queries: 7821
57 Partially correct 33 ms 688 KB Partially correct - number of queries: 7565
58 Partially correct 29 ms 704 KB Partially correct - number of queries: 6731
59 Partially correct 40 ms 928 KB Partially correct - number of queries: 7569
60 Partially correct 33 ms 680 KB Partially correct - number of queries: 6370
61 Correct 1 ms 600 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 2 ms 344 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 3 ms 712 KB Output is correct
67 Correct 3 ms 460 KB Output is correct
68 Correct 3 ms 452 KB Output is correct
69 Correct 3 ms 460 KB Output is correct
70 Correct 2 ms 444 KB Output is correct
71 Partially correct 42 ms 696 KB Partially correct - number of queries: 8026
72 Correct 5 ms 344 KB Output is correct
73 Partially correct 39 ms 452 KB Partially correct - number of queries: 7907
74 Partially correct 41 ms 444 KB Partially correct - number of queries: 7961
75 Correct 2 ms 344 KB Output is correct
76 Partially correct 25 ms 440 KB Partially correct - number of queries: 6831
77 Partially correct 32 ms 700 KB Partially correct - number of queries: 7660
78 Correct 3 ms 344 KB Output is correct
79 Correct 15 ms 688 KB Output is correct
80 Partially correct 30 ms 940 KB Partially correct - number of queries: 7185
81 Partially correct 37 ms 948 KB Partially correct - number of queries: 7408
82 Partially correct 46 ms 684 KB Partially correct - number of queries: 7258
83 Correct 2 ms 340 KB Output is correct
84 Partially correct 24 ms 696 KB Partially correct - number of queries: 5957
85 Partially correct 31 ms 928 KB Partially correct - number of queries: 7415
86 Correct 21 ms 960 KB Output is correct
87 Correct 4 ms 344 KB Output is correct
88 Correct 24 ms 948 KB Output is correct
89 Correct 21 ms 936 KB Output is correct
90 Correct 2 ms 344 KB Output is correct
91 Correct 13 ms 696 KB Output is correct
92 Correct 20 ms 948 KB Output is correct
93 Incorrect 51 ms 1932 KB Incorrect
94 Halted 0 ms 0 KB -