답안 #721472

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721472 2023-04-11T02:08:44 Z minhcool 커다란 상품 (IOI17_prize) C++17
94.11 / 100
76 ms 336 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
 
const int N = 3e5 + 5;
 
const int oo = 1e18 + 7, mod = 1e9 + 7;
 
int n;
 
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int rnd(int l, int r){
	int temp = rng() % (r - l + 1);
	return abs(temp) + l;
}
 
vector<int> askk(int pos){
	return ask(pos - 1);
}
 
int find_best(int N){
	n = N;
	if(n <= 5000){
		for(int i = 1; i <= n; i++){
			vector<int> res = askk(i);
			if(res[0] == 0 && res[1] == 0) return i - 1;
		}
	}
	//cout << "OK\n";
	int mx = -1;
  /*
	for(int i = 1; i <= 500; i++){
		vector<int> v = askk(rnd(1, n));
		mx = max(mx, v[0] + v[1]);
	}*/
	int itr = 0, tot = 0;
	while(1){
      if(itr >= n) return n - 1;
		int l = itr + 1, r = n;
        bool ck = 0;
		while(l < r){
			int mid = (l + r) >> 1;
            if(!ck) mid = min(l + 500, n);        
			vector<int> a = askk(mid);
            mx = max(mx, a[0] + a[1]);
			if(a[0] + a[1] != mx){
              r = mid;
              ck = 1;
            }
			else if(a[0] > tot){
              r = mid;
              ck = 1;
            }
			else l = mid + 1;
		}
		vector<int> v = askk(l);
		if(!(v[0] + v[1])) return l - 1;
		itr = l;
        tot++;
		/*
		assert(l != n);
		vector<int> v = ask(l + 1);
		assert(v[0] + v[1] != mx);
		if(!(v[0] + v[1])) return l + 1;
		int temp = l + 1;
		set<int> se;
		se.insert(mx);
		se.insert(v[0] + v[1]);*/
	}
}
 
 
/*
void process(){
 
}
 
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	while(t--) process();
}
*/

Compilation message

prize.cpp:16:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   16 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 276 KB Output is correct
3 Correct 3 ms 208 KB Output is correct
4 Correct 4 ms 296 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 1 ms 292 KB Output is correct
7 Correct 2 ms 300 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 2 ms 292 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 4 ms 276 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 4 ms 292 KB Output is correct
5 Correct 3 ms 292 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 2 ms 208 KB Output is correct
8 Correct 5 ms 208 KB Output is correct
9 Correct 7 ms 208 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
11 Correct 2 ms 292 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 9 ms 208 KB Output is correct
14 Correct 3 ms 208 KB Output is correct
15 Correct 4 ms 296 KB Output is correct
16 Correct 36 ms 280 KB Output is correct
17 Correct 1 ms 280 KB Output is correct
18 Partially correct 41 ms 300 KB Partially correct - number of queries: 5192
19 Correct 1 ms 272 KB Output is correct
20 Correct 14 ms 296 KB Output is correct
21 Correct 17 ms 276 KB Output is correct
22 Correct 3 ms 208 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 2 ms 292 KB Output is correct
25 Correct 23 ms 208 KB Output is correct
26 Correct 31 ms 280 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Partially correct 35 ms 272 KB Partially correct - number of queries: 5103
29 Correct 31 ms 296 KB Output is correct
30 Partially correct 76 ms 208 KB Partially correct - number of queries: 5148
31 Correct 2 ms 208 KB Output is correct
32 Correct 7 ms 296 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 14 ms 208 KB Output is correct
35 Correct 6 ms 280 KB Output is correct
36 Correct 13 ms 208 KB Output is correct
37 Correct 2 ms 208 KB Output is correct
38 Correct 1 ms 208 KB Output is correct
39 Correct 39 ms 208 KB Output is correct
40 Correct 37 ms 276 KB Output is correct
41 Correct 25 ms 296 KB Output is correct
42 Correct 33 ms 208 KB Output is correct
43 Correct 35 ms 208 KB Output is correct
44 Correct 12 ms 208 KB Output is correct
45 Correct 26 ms 296 KB Output is correct
46 Correct 1 ms 208 KB Output is correct
47 Correct 27 ms 208 KB Output is correct
48 Correct 61 ms 300 KB Output is correct
49 Correct 5 ms 208 KB Output is correct
50 Partially correct 68 ms 276 KB Partially correct - number of queries: 5192
51 Correct 18 ms 208 KB Output is correct
52 Correct 1 ms 292 KB Output is correct
53 Correct 3 ms 296 KB Output is correct
54 Correct 32 ms 208 KB Output is correct
55 Correct 1 ms 208 KB Output is correct
56 Partially correct 41 ms 272 KB Partially correct - number of queries: 5192
57 Correct 18 ms 292 KB Output is correct
58 Correct 35 ms 276 KB Output is correct
59 Correct 30 ms 208 KB Output is correct
60 Correct 29 ms 292 KB Output is correct
61 Correct 3 ms 208 KB Output is correct
62 Correct 1 ms 208 KB Output is correct
63 Correct 5 ms 208 KB Output is correct
64 Correct 3 ms 292 KB Output is correct
65 Correct 6 ms 208 KB Output is correct
66 Partially correct 55 ms 280 KB Partially correct - number of queries: 5066
67 Correct 3 ms 292 KB Output is correct
68 Correct 33 ms 272 KB Output is correct
69 Correct 58 ms 272 KB Output is correct
70 Correct 3 ms 292 KB Output is correct
71 Partially correct 43 ms 208 KB Partially correct - number of queries: 5356
72 Correct 8 ms 208 KB Output is correct
73 Partially correct 62 ms 208 KB Partially correct - number of queries: 5287
74 Partially correct 55 ms 208 KB Partially correct - number of queries: 5317
75 Correct 4 ms 208 KB Output is correct
76 Correct 35 ms 208 KB Output is correct
77 Partially correct 63 ms 208 KB Partially correct - number of queries: 5343
78 Correct 7 ms 208 KB Output is correct
79 Correct 22 ms 208 KB Output is correct
80 Partially correct 26 ms 292 KB Partially correct - number of queries: 5353
81 Partially correct 43 ms 208 KB Partially correct - number of queries: 5350
82 Partially correct 54 ms 208 KB Partially correct - number of queries: 5313
83 Correct 6 ms 208 KB Output is correct
84 Correct 45 ms 208 KB Output is correct
85 Partially correct 58 ms 292 KB Partially correct - number of queries: 5351
86 Partially correct 56 ms 208 KB Partially correct - number of queries: 5589
87 Correct 13 ms 208 KB Output is correct
88 Partially correct 52 ms 208 KB Partially correct - number of queries: 5292
89 Partially correct 50 ms 208 KB Partially correct - number of queries: 5545
90 Correct 3 ms 208 KB Output is correct
91 Correct 34 ms 300 KB Output is correct
92 Partially correct 48 ms 208 KB Partially correct - number of queries: 5314
93 Partially correct 25 ms 328 KB Partially correct - number of queries: 5551
94 Partially correct 55 ms 208 KB Partially correct - number of queries: 5577
95 Partially correct 56 ms 208 KB Partially correct - number of queries: 5576
96 Partially correct 47 ms 280 KB Partially correct - number of queries: 5535
97 Correct 3 ms 272 KB Output is correct