답안 #1013416

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1013416 2024-07-03T14:04:13 Z NintsiChkhaidze 커다란 상품 (IOI17_prize) C++17
90 / 100
52 ms 5952 KB
#include <bits/stdc++.h>
#define pb push_back
#include "prize.h"
using namespace std;
 
bool fix[200003];
int Q;
vector <int> dp[200003];
 
vector <int> askk(int x){
	return ask(x);
}
 
int find_best(int n){
	
	int block = 500,mx = -1,idx = -1;
	vector <int> opt;
		
	for (int i = 0; i < min(n,block); i++){
		vector <int> vec = askk(i);
		int sum = vec[0] + vec[1];
		if (sum == 0) return i;
		
		if (sum > mx){
			mx = sum;
			opt = vec;
			idx = i;
		}
	}
 
	for (int i = idx; i < n; i++){
		vector <int> vec = askk(i);
		if (vec[0] + vec[1] == 0) {
			return i;
		}
		if (vec[0] + vec[1] != mx) {
			fix[i] = 1;
			continue;
		}
		
		opt = vec;
		int id = i;
		int l = i, r = n - 1,res = i;
		
		while (l <= r){
			int mid = (l + r)/2;
			vector <int> vec = askk(mid);
			if (vec[0] + vec[1] == 0) {
				return mid;
			}
			
			if (vec != opt){
				r = mid - 1;
			}else{
				res = mid;
				l = mid + 1;
			}
		}
	
		for (int j = id; j <= res; j++)	
			fix[j] = 1;
			
		i = res;
	}
	
	for (int i = 0; i < n; i++){
		if (!fix[i]){
			vector <int> vec = askk(i);
			
			if (vec[0] + vec[1] == 0) {
				return i; 
			}
		}
	}
	
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:17:15: warning: control reaches end of non-void function [-Wreturn-type]
   17 |  vector <int> opt;
      |               ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4952 KB Output is correct
2 Correct 4 ms 5128 KB Output is correct
3 Correct 4 ms 5136 KB Output is correct
4 Correct 5 ms 4952 KB Output is correct
5 Correct 3 ms 4952 KB Output is correct
6 Correct 1 ms 4952 KB Output is correct
7 Correct 3 ms 4952 KB Output is correct
8 Correct 5 ms 4952 KB Output is correct
9 Correct 5 ms 4952 KB Output is correct
10 Correct 4 ms 4952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4952 KB Output is correct
2 Correct 4 ms 4952 KB Output is correct
3 Correct 3 ms 4952 KB Output is correct
4 Correct 3 ms 4952 KB Output is correct
5 Correct 3 ms 4952 KB Output is correct
6 Correct 1 ms 5132 KB Output is correct
7 Correct 3 ms 4952 KB Output is correct
8 Correct 3 ms 4952 KB Output is correct
9 Correct 3 ms 4952 KB Output is correct
10 Correct 4 ms 4952 KB Output is correct
11 Correct 5 ms 5208 KB Output is correct
12 Correct 4 ms 4952 KB Output is correct
13 Correct 8 ms 5208 KB Output is correct
14 Correct 5 ms 4952 KB Output is correct
15 Correct 9 ms 5208 KB Output is correct
16 Partially correct 52 ms 5556 KB Partially correct - number of queries: 7830
17 Correct 3 ms 4952 KB Output is correct
18 Partially correct 40 ms 5444 KB Partially correct - number of queries: 9108
19 Correct 4 ms 4952 KB Output is correct
20 Correct 16 ms 5464 KB Output is correct
21 Correct 23 ms 5208 KB Output is correct
22 Correct 8 ms 5208 KB Output is correct
23 Correct 5 ms 4952 KB Output is correct
24 Correct 4 ms 4952 KB Output is correct
25 Partially correct 24 ms 5208 KB Partially correct - number of queries: 5366
26 Partially correct 24 ms 5208 KB Partially correct - number of queries: 5289
27 Correct 4 ms 4952 KB Output is correct
28 Partially correct 50 ms 5488 KB Partially correct - number of queries: 8680
29 Partially correct 30 ms 5424 KB Partially correct - number of queries: 6694
30 Partially correct 28 ms 5744 KB Partially correct - number of queries: 9035
31 Correct 4 ms 4952 KB Output is correct
32 Correct 5 ms 5208 KB Output is correct
33 Correct 1 ms 4952 KB Output is correct
34 Correct 16 ms 5412 KB Output is correct
35 Correct 4 ms 5208 KB Output is correct
36 Correct 10 ms 5220 KB Output is correct
37 Correct 4 ms 4952 KB Output is correct
38 Correct 5 ms 4952 KB Output is correct
39 Correct 22 ms 4952 KB Output is correct
40 Partially correct 41 ms 5396 KB Partially correct - number of queries: 7789
41 Partially correct 28 ms 5952 KB Partially correct - number of queries: 5646
42 Partially correct 18 ms 5208 KB Partially correct - number of queries: 5646
43 Partially correct 30 ms 5388 KB Partially correct - number of queries: 5146
44 Correct 21 ms 5396 KB Output is correct
45 Correct 13 ms 4952 KB Output is correct
46 Correct 2 ms 4948 KB Output is correct
47 Correct 18 ms 5180 KB Output is correct
48 Partially correct 42 ms 5200 KB Partially correct - number of queries: 6860
49 Correct 5 ms 5140 KB Output is correct
50 Partially correct 42 ms 5420 KB Partially correct - number of queries: 9097
51 Correct 14 ms 5208 KB Output is correct
52 Correct 3 ms 4952 KB Output is correct
53 Correct 3 ms 5208 KB Output is correct
54 Correct 22 ms 5396 KB Output is correct
55 Correct 3 ms 4952 KB Output is correct
56 Partially correct 29 ms 5464 KB Partially correct - number of queries: 9105
57 Partially correct 43 ms 5408 KB Partially correct - number of queries: 6771
58 Partially correct 28 ms 5168 KB Partially correct - number of queries: 6879
59 Partially correct 20 ms 5200 KB Partially correct - number of queries: 5646
60 Partially correct 24 ms 5392 KB Partially correct - number of queries: 5272
61 Correct 4 ms 5140 KB Output is correct
62 Correct 2 ms 4952 KB Output is correct
63 Correct 5 ms 5464 KB Output is correct
64 Correct 3 ms 5208 KB Output is correct
65 Correct 4 ms 5136 KB Output is correct
66 Correct 7 ms 5208 KB Output is correct
67 Correct 3 ms 4952 KB Output is correct
68 Correct 2 ms 4952 KB Output is correct
69 Correct 6 ms 5132 KB Output is correct
70 Correct 3 ms 4952 KB Output is correct
71 Partially correct 42 ms 5664 KB Partially correct - number of queries: 9244
72 Correct 5 ms 5208 KB Output is correct
73 Partially correct 37 ms 5472 KB Partially correct - number of queries: 9113
74 Partially correct 41 ms 5168 KB Partially correct - number of queries: 9191
75 Correct 3 ms 5208 KB Output is correct
76 Partially correct 39 ms 5700 KB Partially correct - number of queries: 7940
77 Partially correct 41 ms 5208 KB Partially correct - number of queries: 7611
78 Correct 5 ms 5208 KB Output is correct
79 Correct 17 ms 5368 KB Output is correct
80 Partially correct 43 ms 5452 KB Partially correct - number of queries: 9123
81 Partially correct 46 ms 5396 KB Partially correct - number of queries: 9091
82 Partially correct 43 ms 5388 KB Partially correct - number of queries: 9059
83 Correct 3 ms 5208 KB Output is correct
84 Partially correct 31 ms 5508 KB Partially correct - number of queries: 7552
85 Partially correct 41 ms 5288 KB Partially correct - number of queries: 9149
86 Correct 3 ms 4952 KB Output is correct
87 Correct 4 ms 4952 KB Output is correct
88 Correct 4 ms 4952 KB Output is correct
89 Correct 3 ms 4948 KB Output is correct
90 Correct 3 ms 4952 KB Output is correct
91 Correct 4 ms 4952 KB Output is correct
92 Correct 5 ms 4952 KB Output is correct
93 Correct 5 ms 5208 KB Output is correct
94 Correct 8 ms 5464 KB Output is correct
95 Correct 5 ms 5460 KB Output is correct
96 Correct 5 ms 5140 KB Output is correct
97 Correct 3 ms 4952 KB Output is correct