답안 #347785

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
347785 2021-01-13T12:43:52 Z tengiz05 커다란 상품 (IOI17_prize) C++17
90 / 100
106 ms 620 KB
/** made by amunduzbaev **/
 
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Pi acos(-1);
#define mod 1e9+7
#define inf 1e18
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
 
const int NN = 2e3+5;
 
#include "prize.h"
 
int find_best(int n) {
	int mx = 0;
	for(int i=0;i<n;i++){
		vii tmp = ask(i);
		// finding answer 
		mx = max(tmp[0] + tmp[1], mx);
		if(tmp[0] + tmp[1] == 0){
			return i;
		}
		
		if(tmp[0] + tmp[1] != mx) continue;
		
		int l = i, r = n-1;
		while(l <= r){
			int m = (l + r)>>1;
			vii tt = ask(m);
			if(tt[0] + tt[1] == 0) return m;
			//if(tt[1] == 0) n = m, r = min(r, n-1);
			if(tt[0] == 0 || tt == tmp) i = m, l = m+1;
			else r = m-1;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 3 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 8 ms 364 KB Output is correct
14 Correct 5 ms 364 KB Output is correct
15 Correct 14 ms 364 KB Output is correct
16 Partially correct 52 ms 364 KB Partially correct - number of queries: 7307
17 Correct 1 ms 492 KB Output is correct
18 Partially correct 106 ms 492 KB Partially correct - number of queries: 8595
19 Correct 1 ms 364 KB Output is correct
20 Correct 30 ms 364 KB Output is correct
21 Correct 41 ms 364 KB Output is correct
22 Correct 6 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 62 ms 364 KB Output is correct
26 Correct 61 ms 384 KB Output is correct
27 Correct 2 ms 364 KB Output is correct
28 Partially correct 69 ms 364 KB Partially correct - number of queries: 8021
29 Partially correct 59 ms 364 KB Partially correct - number of queries: 6176
30 Partially correct 100 ms 364 KB Partially correct - number of queries: 8509
31 Correct 1 ms 364 KB Output is correct
32 Correct 5 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 29 ms 364 KB Output is correct
35 Correct 2 ms 364 KB Output is correct
36 Correct 24 ms 364 KB Output is correct
37 Correct 2 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 45 ms 364 KB Output is correct
40 Partially correct 68 ms 364 KB Partially correct - number of queries: 7202
41 Partially correct 44 ms 364 KB Partially correct - number of queries: 5121
42 Partially correct 45 ms 368 KB Partially correct - number of queries: 5121
43 Correct 24 ms 268 KB Output is correct
44 Correct 35 ms 364 KB Output is correct
45 Correct 35 ms 364 KB Output is correct
46 Correct 1 ms 492 KB Output is correct
47 Correct 22 ms 492 KB Output is correct
48 Partially correct 64 ms 364 KB Partially correct - number of queries: 6346
49 Correct 4 ms 620 KB Output is correct
50 Partially correct 78 ms 364 KB Partially correct - number of queries: 8532
51 Correct 28 ms 364 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 3 ms 364 KB Output is correct
54 Correct 30 ms 364 KB Output is correct
55 Correct 1 ms 364 KB Output is correct
56 Partially correct 76 ms 364 KB Partially correct - number of queries: 8592
57 Partially correct 76 ms 364 KB Partially correct - number of queries: 6254
58 Partially correct 65 ms 364 KB Partially correct - number of queries: 6338
59 Partially correct 47 ms 364 KB Partially correct - number of queries: 5121
60 Correct 44 ms 364 KB Output is correct
61 Correct 2 ms 364 KB Output is correct
62 Correct 1 ms 364 KB Output is correct
63 Correct 2 ms 364 KB Output is correct
64 Correct 2 ms 364 KB Output is correct
65 Correct 1 ms 492 KB Output is correct
66 Correct 1 ms 368 KB Output is correct
67 Correct 1 ms 364 KB Output is correct
68 Correct 1 ms 364 KB Output is correct
69 Correct 6 ms 364 KB Output is correct
70 Correct 1 ms 364 KB Output is correct
71 Partially correct 56 ms 492 KB Partially correct - number of queries: 8264
72 Correct 5 ms 364 KB Output is correct
73 Partially correct 95 ms 492 KB Partially correct - number of queries: 8166
74 Partially correct 85 ms 364 KB Partially correct - number of queries: 8210
75 Correct 2 ms 364 KB Output is correct
76 Partially correct 79 ms 364 KB Partially correct - number of queries: 7047
77 Partially correct 45 ms 368 KB Partially correct - number of queries: 8560
78 Correct 7 ms 368 KB Output is correct
79 Correct 21 ms 364 KB Output is correct
80 Partially correct 66 ms 364 KB Partially correct - number of queries: 8603
81 Partially correct 66 ms 364 KB Partially correct - number of queries: 8581
82 Partially correct 100 ms 364 KB Partially correct - number of queries: 8516
83 Correct 1 ms 364 KB Output is correct
84 Partially correct 64 ms 364 KB Partially correct - number of queries: 7012
85 Partially correct 82 ms 364 KB Partially correct - number of queries: 8566
86 Correct 30 ms 364 KB Output is correct
87 Correct 3 ms 364 KB Output is correct
88 Correct 15 ms 364 KB Output is correct
89 Correct 17 ms 364 KB Output is correct
90 Correct 1 ms 364 KB Output is correct
91 Correct 11 ms 364 KB Output is correct
92 Correct 1 ms 364 KB Output is correct
93 Correct 5 ms 364 KB Output is correct
94 Correct 5 ms 364 KB Output is correct
95 Correct 5 ms 364 KB Output is correct
96 Correct 4 ms 364 KB Output is correct
97 Correct 1 ms 364 KB Output is correct