답안 #347800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
347800 2021-01-13T13:58:19 Z amunduzbaev 커다란 상품 (IOI17_prize) C++14
90 / 100
109 ms 512 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 492 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 492 KB Output is correct
6 Correct 1 ms 492 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 492 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 368 KB Output is correct
6 Correct 1 ms 368 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 16 ms 364 KB Output is correct
16 Partially correct 60 ms 364 KB Partially correct - number of queries: 7307
17 Correct 1 ms 364 KB Output is correct
18 Partially correct 56 ms 364 KB Partially correct - number of queries: 8595
19 Correct 1 ms 364 KB Output is correct
20 Correct 28 ms 364 KB Output is correct
21 Correct 36 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 492 KB Output is correct
25 Correct 52 ms 364 KB Output is correct
26 Correct 38 ms 364 KB Output is correct
27 Correct 2 ms 364 KB Output is correct
28 Partially correct 75 ms 364 KB Partially correct - number of queries: 8021
29 Partially correct 64 ms 364 KB Partially correct - number of queries: 6176
30 Partially correct 71 ms 364 KB Partially correct - number of queries: 8509
31 Correct 1 ms 364 KB Output is correct
32 Correct 5 ms 492 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 33 ms 364 KB Output is correct
35 Correct 2 ms 364 KB Output is correct
36 Correct 16 ms 364 KB Output is correct
37 Correct 3 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 38 ms 364 KB Output is correct
40 Partially correct 67 ms 364 KB Partially correct - number of queries: 7202
41 Partially correct 46 ms 364 KB Partially correct - number of queries: 5121
42 Partially correct 64 ms 364 KB Partially correct - number of queries: 5121
43 Correct 42 ms 492 KB Output is correct
44 Correct 39 ms 364 KB Output is correct
45 Correct 16 ms 268 KB Output is correct
46 Correct 1 ms 364 KB Output is correct
47 Correct 39 ms 364 KB Output is correct
48 Partially correct 53 ms 364 KB Partially correct - number of queries: 6346
49 Correct 9 ms 364 KB Output is correct
50 Partially correct 45 ms 492 KB Partially correct - number of queries: 8532
51 Correct 32 ms 364 KB Output is correct
52 Correct 2 ms 364 KB Output is correct
53 Correct 2 ms 364 KB Output is correct
54 Correct 31 ms 364 KB Output is correct
55 Correct 1 ms 364 KB Output is correct
56 Partially correct 86 ms 364 KB Partially correct - number of queries: 8592
57 Partially correct 49 ms 364 KB Partially correct - number of queries: 6254
58 Partially correct 64 ms 364 KB Partially correct - number of queries: 6338
59 Partially correct 64 ms 364 KB Partially correct - number of queries: 5121
60 Correct 53 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 1 ms 364 KB Output is correct
65 Correct 1 ms 364 KB Output is correct
66 Correct 1 ms 364 KB Output is correct
67 Correct 1 ms 364 KB Output is correct
68 Correct 1 ms 364 KB Output is correct
69 Correct 5 ms 364 KB Output is correct
70 Correct 1 ms 364 KB Output is correct
71 Partially correct 70 ms 364 KB Partially correct - number of queries: 8264
72 Correct 7 ms 492 KB Output is correct
73 Partially correct 91 ms 364 KB Partially correct - number of queries: 8166
74 Partially correct 98 ms 512 KB Partially correct - number of queries: 8210
75 Correct 2 ms 364 KB Output is correct
76 Partially correct 56 ms 364 KB Partially correct - number of queries: 7047
77 Partially correct 106 ms 364 KB Partially correct - number of queries: 8560
78 Correct 7 ms 364 KB Output is correct
79 Correct 23 ms 364 KB Output is correct
80 Partially correct 80 ms 364 KB Partially correct - number of queries: 8603
81 Partially correct 109 ms 364 KB Partially correct - number of queries: 8581
82 Partially correct 96 ms 364 KB Partially correct - number of queries: 8516
83 Correct 2 ms 364 KB Output is correct
84 Partially correct 60 ms 364 KB Partially correct - number of queries: 7012
85 Partially correct 97 ms 364 KB Partially correct - number of queries: 8566
86 Correct 13 ms 364 KB Output is correct
87 Correct 3 ms 364 KB Output is correct
88 Correct 20 ms 364 KB Output is correct
89 Correct 16 ms 364 KB Output is correct
90 Correct 2 ms 364 KB Output is correct
91 Correct 11 ms 492 KB Output is correct
92 Correct 1 ms 364 KB Output is correct
93 Correct 7 ms 364 KB Output is correct
94 Correct 5 ms 364 KB Output is correct
95 Correct 7 ms 364 KB Output is correct
96 Correct 4 ms 364 KB Output is correct
97 Correct 1 ms 364 KB Output is correct