답안 #334995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334995 2020-12-10T17:18:56 Z LucaDantas 커다란 상품 (IOI17_prize) C++17
100 / 100
57 ms 1536 KB
#include<bits/stdc++.h>
using namespace std;
#include "prize.h"

std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count() ^ (long long) (make_unique<char>().get()));

template<typename T> T rnd(T v) {
  T k = (T) rng();
  return (T) (((k % v) + v) % v);
}


#define pb push_back
#define sz(a) (int)((a).size())

const vector<int> good = {0, 0};

constexpr int maxn = 2e5+10;

map<int,set<int>> s;
int ans[maxn];

int solve(int l, int r) {
	if(l > r) return -1;
	int m = (l+r) >> 1;
	vector<int> get = ask(m);
	if(get == good) return m;
	ans[m] = get[0];
	auto it = s[get[0]+get[1]].insert(m).first;
	if(it == s[get[0]+get[1]].begin() || ans[*prev(it)] != ans[m]) {
		int ans = solve(l, m-1);
		if(ans != -1) return ans;
	}
	if(it == --s[get[0]+get[1]].end() || ans[*next(it)] != ans[m]) {
		int ans = solve(m+1, r);
		if(ans != -1) return ans;
	}
	return -1;
}

int find_best(int n) {
	return solve(0, n-1);
}
# 결과 실행 시간 메모리 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 500 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 500 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 384 KB Output is correct
2 Correct 1 ms 500 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 520 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 384 KB Output is correct
11 Correct 2 ms 492 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 6 ms 876 KB Output is correct
14 Correct 3 ms 492 KB Output is correct
15 Correct 8 ms 492 KB Output is correct
16 Correct 31 ms 1220 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 43 ms 1260 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 11 ms 512 KB Output is correct
21 Correct 10 ms 712 KB Output is correct
22 Correct 4 ms 492 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 21 ms 876 KB Output is correct
26 Correct 22 ms 876 KB Output is correct
27 Correct 1 ms 492 KB Output is correct
28 Correct 36 ms 1388 KB Output is correct
29 Correct 33 ms 1132 KB Output is correct
30 Correct 38 ms 1260 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 4 ms 620 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 14 ms 640 KB Output is correct
35 Correct 2 ms 492 KB Output is correct
36 Correct 11 ms 620 KB Output is correct
37 Correct 1 ms 536 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 25 ms 748 KB Output is correct
40 Correct 30 ms 1536 KB Output is correct
41 Correct 29 ms 876 KB Output is correct
42 Correct 26 ms 1004 KB Output is correct
43 Correct 25 ms 876 KB Output is correct
44 Correct 19 ms 748 KB Output is correct
45 Correct 11 ms 672 KB Output is correct
46 Correct 1 ms 364 KB Output is correct
47 Correct 20 ms 748 KB Output is correct
48 Correct 31 ms 1004 KB Output is correct
49 Correct 4 ms 364 KB Output is correct
50 Correct 43 ms 1260 KB Output is correct
51 Correct 18 ms 748 KB Output is correct
52 Correct 1 ms 492 KB Output is correct
53 Correct 2 ms 512 KB Output is correct
54 Correct 25 ms 748 KB Output is correct
55 Correct 1 ms 364 KB Output is correct
56 Correct 50 ms 1260 KB Output is correct
57 Correct 32 ms 1004 KB Output is correct
58 Correct 30 ms 1004 KB Output is correct
59 Correct 36 ms 876 KB Output is correct
60 Correct 33 ms 956 KB Output is correct
61 Correct 2 ms 568 KB Output is correct
62 Correct 1 ms 364 KB Output is correct
63 Correct 3 ms 492 KB Output is correct
64 Correct 1 ms 448 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 1 ms 364 KB Output is correct
70 Correct 1 ms 364 KB Output is correct
71 Correct 57 ms 1348 KB Output is correct
72 Correct 6 ms 748 KB Output is correct
73 Correct 34 ms 1348 KB Output is correct
74 Correct 50 ms 1388 KB Output is correct
75 Correct 2 ms 492 KB Output is correct
76 Correct 51 ms 1260 KB Output is correct
77 Correct 39 ms 1332 KB Output is correct
78 Correct 7 ms 748 KB Output is correct
79 Correct 34 ms 1260 KB Output is correct
80 Correct 48 ms 1260 KB Output is correct
81 Correct 55 ms 1292 KB Output is correct
82 Correct 28 ms 1416 KB Output is correct
83 Correct 2 ms 492 KB Output is correct
84 Correct 36 ms 1260 KB Output is correct
85 Correct 45 ms 1388 KB Output is correct
86 Correct 7 ms 768 KB Output is correct
87 Correct 4 ms 620 KB Output is correct
88 Correct 7 ms 748 KB Output is correct
89 Correct 6 ms 748 KB Output is correct
90 Correct 2 ms 492 KB Output is correct
91 Correct 4 ms 620 KB Output is correct
92 Correct 1 ms 364 KB Output is correct
93 Correct 4 ms 620 KB Output is correct
94 Correct 5 ms 748 KB Output is correct
95 Correct 6 ms 620 KB Output is correct
96 Correct 2 ms 620 KB Output is correct
97 Correct 1 ms 364 KB Output is correct