답안 #1029212

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029212 2024-07-20T13:51:22 Z amirhoseinfar1385 커다란 상품 (IOI17_prize) C++17
90 / 100
228 ms 1260 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
map<int,pair<int,int>>mp;
int cnta=0;

pair<int,int>pors(int u){
	if(mp.count(u)==0){
		cnta++;
		if(cnta>=10000){
			exit(23);
		}
		vector<int>hey=ask(u);
		mp[u]=make_pair(hey[0],hey[1]);
	}
	return mp[u];
}
 
int find_best(int n) {
	mp.clear();
	int cnta=0;
	for(int i=0;i<n;){
		//cout<<i<<endl;
		pair<int,int>av=pors(i);
		if(av.first+av.second==0){
			return i;
		}
		cnta++;
		pair<int,int>fake;
		int low=i,high=n,mid,f=0;
		for(auto x:mp){
			mid=x.first;
			fake=pors(mid);
			if(fake.first+fake.second!=av.first+av.second){
				if(fake.first+fake.second>av.first+av.second){
					i++;
					f=1;
					break;
				}
				high=mid;
			}else{
				if(fake.first-av.first==0){
					low=mid;
				}else{
					high=mid;
				}
			}
		}
		if(f){
			continue;
		}
		low=max(low,i);
		high=n;
		while(high-low>1){
			mid=(high+low)>>1;
			fake=pors(mid);
			if(fake.first+fake.second!=av.first+av.second){
				if(fake.first+fake.second>av.first+av.second){
					break;
				}
				high=mid;
			}else{
				if(fake.first-av.first==0){
					low=mid;
				}else{
					high=mid;
				}
			}
		}
		i=low+1;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 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 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 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 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 0 ms 432 KB Output is correct
13 Correct 3 ms 448 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 10 ms 600 KB Output is correct
16 Partially correct 155 ms 988 KB Partially correct - number of queries: 6423
17 Correct 0 ms 344 KB Output is correct
18 Partially correct 228 ms 836 KB Partially correct - number of queries: 7529
19 Correct 1 ms 344 KB Output is correct
20 Correct 19 ms 344 KB Output is correct
21 Correct 37 ms 600 KB Output is correct
22 Correct 4 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 73 ms 840 KB Output is correct
26 Correct 80 ms 820 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Partially correct 191 ms 980 KB Partially correct - number of queries: 7236
29 Partially correct 127 ms 944 KB Partially correct - number of queries: 5524
30 Partially correct 217 ms 1104 KB Partially correct - number of queries: 7450
31 Correct 1 ms 344 KB Output is correct
32 Correct 3 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 27 ms 700 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 13 ms 680 KB Output is correct
37 Correct 1 ms 424 KB Output is correct
38 Correct 0 ms 428 KB Output is correct
39 Correct 50 ms 624 KB Output is correct
40 Partially correct 139 ms 876 KB Partially correct - number of queries: 6397
41 Correct 82 ms 492 KB Output is correct
42 Correct 75 ms 820 KB Output is correct
43 Correct 54 ms 628 KB Output is correct
44 Correct 32 ms 548 KB Output is correct
45 Correct 24 ms 568 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 55 ms 984 KB Output is correct
48 Partially correct 114 ms 788 KB Partially correct - number of queries: 5588
49 Correct 3 ms 424 KB Output is correct
50 Partially correct 194 ms 1132 KB Partially correct - number of queries: 7532
51 Correct 37 ms 592 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 1 ms 428 KB Output is correct
54 Correct 43 ms 944 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Partially correct 202 ms 1156 KB Partially correct - number of queries: 7532
57 Partially correct 116 ms 856 KB Partially correct - number of queries: 5490
58 Partially correct 104 ms 732 KB Partially correct - number of queries: 5582
59 Correct 65 ms 844 KB Output is correct
60 Correct 65 ms 600 KB Output is correct
61 Correct 1 ms 344 KB Output is correct
62 Correct 1 ms 428 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Correct 4 ms 868 KB Output is correct
67 Correct 1 ms 344 KB Output is correct
68 Correct 7 ms 344 KB Output is correct
69 Correct 2 ms 344 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Partially correct 191 ms 1260 KB Partially correct - number of queries: 7398
72 Correct 5 ms 344 KB Output is correct
73 Partially correct 195 ms 1060 KB Partially correct - number of queries: 7242
74 Partially correct 188 ms 824 KB Partially correct - number of queries: 7313
75 Correct 1 ms 344 KB Output is correct
76 Partially correct 136 ms 772 KB Partially correct - number of queries: 6365
77 Partially correct 202 ms 872 KB Partially correct - number of queries: 7519
78 Correct 4 ms 344 KB Output is correct
79 Correct 37 ms 600 KB Output is correct
80 Partially correct 200 ms 856 KB Partially correct - number of queries: 7543
81 Partially correct 179 ms 892 KB Partially correct - number of queries: 7487
82 Partially correct 193 ms 844 KB Partially correct - number of queries: 7475
83 Correct 1 ms 600 KB Output is correct
84 Partially correct 141 ms 964 KB Partially correct - number of queries: 6195
85 Partially correct 181 ms 740 KB Partially correct - number of queries: 7501
86 Partially correct 144 ms 956 KB Partially correct - number of queries: 6419
87 Correct 3 ms 344 KB Output is correct
88 Partially correct 139 ms 1096 KB Partially correct - number of queries: 6076
89 Partially correct 154 ms 756 KB Partially correct - number of queries: 6399
90 Correct 1 ms 344 KB Output is correct
91 Correct 55 ms 604 KB Output is correct
92 Correct 0 ms 344 KB Output is correct
93 Correct 2 ms 344 KB Output is correct
94 Correct 2 ms 344 KB Output is correct
95 Correct 3 ms 344 KB Output is correct
96 Correct 2 ms 344 KB Output is correct
97 Correct 0 ms 344 KB Output is correct