# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
136007 | 2019-07-24T15:19:23 Z | JustasZ | 커다란 상품 (IOI17_prize) | C++14 | 102 ms | 504 KB |
#include "prize.h" #include <bits/stdc++.h> #define pb push_back #define all(a) a.begin(), a.end() #define sz(a) (int)a.size() #define x first #define y second #define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n" #define rd() abs((int)rng()) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int>pii; const int maxn = 2e5 + 100; const int mod = 1e9 + 7; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); /*vector<int> ask(int i) { cout << "? " << i << endl; vector<int>a(2); cin >> a[0] >> a[1]; return a; }*/ int find_best(int n) { vector<int>a; if(n < 5000) { for(int i = 0; i < n; i++) { a = ask(i); if(a[0] == 0 && a[1] == 0) return i; } } int mx = 0; for(int it = 0; it < 5; it++) { int p = rd() % n; a = ask(p); mx = max(mx, a[0] + a[1]); } assert(mx < 500); int cnt = 5; int i = 0; while(i < n) { //assert(++cnt < 10000); a = ask(i); if(a[0] + a[1] == 0) return i; if(a[0] + a[1] == mx) { int fi = a[0], se = a[1]; int l = i + 1, r = n - 1; while(l < r) { int mid = (l + r) / 2; //assert(++cnt < 10000); a = ask(mid); if(a[0] + a[1] != mx) r = mid; else { if(a[0] > fi) r = mid - 1; else l = mid + 1; } } //assert(++cnt < 10000); a = ask(l); //assert(a[0] + a[1] != mx); if(a[0] + a[1] == 0) return l; i = l + 1; } else i++; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 248 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 248 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 248 KB | Output is correct |
10 | Correct | 2 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 380 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 248 KB | Output is correct |
8 | Correct | 18 ms | 252 KB | Output is correct |
9 | Correct | 2 ms | 504 KB | Output is correct |
10 | Correct | 2 ms | 392 KB | Output is correct |
11 | Correct | 3 ms | 400 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 248 KB | Output is correct |
15 | Correct | 19 ms | 396 KB | Output is correct |
16 | Partially correct | 74 ms | 396 KB | Partially correct - number of queries: 7101 |
17 | Correct | 2 ms | 248 KB | Output is correct |
18 | Partially correct | 70 ms | 396 KB | Partially correct - number of queries: 8332 |
19 | Correct | 2 ms | 248 KB | Output is correct |
20 | Correct | 28 ms | 376 KB | Output is correct |
21 | Correct | 38 ms | 376 KB | Output is correct |
22 | Correct | 10 ms | 376 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 2 ms | 316 KB | Output is correct |
25 | Correct | 42 ms | 248 KB | Output is correct |
26 | Correct | 32 ms | 248 KB | Output is correct |
27 | Correct | 3 ms | 248 KB | Output is correct |
28 | Partially correct | 58 ms | 376 KB | Partially correct - number of queries: 7909 |
29 | Partially correct | 65 ms | 376 KB | Partially correct - number of queries: 5989 |
30 | Partially correct | 52 ms | 396 KB | Partially correct - number of queries: 8268 |
31 | Correct | 2 ms | 248 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 2 ms | 248 KB | Output is correct |
34 | Correct | 29 ms | 400 KB | Output is correct |
35 | Correct | 3 ms | 400 KB | Output is correct |
36 | Correct | 21 ms | 248 KB | Output is correct |
37 | Correct | 4 ms | 376 KB | Output is correct |
38 | Correct | 2 ms | 376 KB | Output is correct |
39 | Correct | 30 ms | 292 KB | Output is correct |
40 | Partially correct | 70 ms | 248 KB | Partially correct - number of queries: 7066 |
41 | Correct | 26 ms | 396 KB | Output is correct |
42 | Correct | 33 ms | 376 KB | Output is correct |
43 | Correct | 38 ms | 376 KB | Output is correct |
44 | Correct | 45 ms | 316 KB | Output is correct |
45 | Correct | 34 ms | 312 KB | Output is correct |
46 | Correct | 2 ms | 248 KB | Output is correct |
47 | Correct | 22 ms | 396 KB | Output is correct |
48 | Partially correct | 61 ms | 248 KB | Partially correct - number of queries: 6160 |
49 | Correct | 9 ms | 248 KB | Output is correct |
50 | Partially correct | 57 ms | 376 KB | Partially correct - number of queries: 8321 |
51 | Correct | 34 ms | 248 KB | Output is correct |
52 | Correct | 3 ms | 312 KB | Output is correct |
53 | Correct | 3 ms | 308 KB | Output is correct |
54 | Correct | 39 ms | 376 KB | Output is correct |
55 | Correct | 2 ms | 504 KB | Output is correct |
56 | Partially correct | 102 ms | 308 KB | Partially correct - number of queries: 8321 |
57 | Partially correct | 35 ms | 432 KB | Partially correct - number of queries: 6084 |
58 | Partially correct | 50 ms | 312 KB | Partially correct - number of queries: 6187 |
59 | Correct | 44 ms | 312 KB | Output is correct |
60 | Correct | 35 ms | 400 KB | Output is correct |
61 | Correct | 3 ms | 316 KB | Output is correct |
62 | Correct | 2 ms | 248 KB | Output is correct |
63 | Correct | 4 ms | 248 KB | Output is correct |
64 | Correct | 2 ms | 312 KB | Output is correct |
65 | Correct | 3 ms | 376 KB | Output is correct |
66 | Correct | 6 ms | 376 KB | Output is correct |
67 | Correct | 2 ms | 396 KB | Output is correct |
68 | Correct | 6 ms | 248 KB | Output is correct |
69 | Correct | 4 ms | 312 KB | Output is correct |
70 | Correct | 2 ms | 312 KB | Output is correct |
71 | Partially correct | 51 ms | 396 KB | Partially correct - number of queries: 8295 |
72 | Correct | 7 ms | 380 KB | Output is correct |
73 | Partially correct | 53 ms | 376 KB | Partially correct - number of queries: 8184 |
74 | Partially correct | 76 ms | 248 KB | Partially correct - number of queries: 8287 |
75 | Correct | 4 ms | 248 KB | Output is correct |
76 | Partially correct | 57 ms | 248 KB | Partially correct - number of queries: 7071 |
77 | Partially correct | 75 ms | 248 KB | Partially correct - number of queries: 8364 |
78 | Correct | 9 ms | 392 KB | Output is correct |
79 | Correct | 42 ms | 248 KB | Output is correct |
80 | Partially correct | 46 ms | 312 KB | Partially correct - number of queries: 8396 |
81 | Partially correct | 75 ms | 252 KB | Partially correct - number of queries: 8370 |
82 | Partially correct | 86 ms | 308 KB | Partially correct - number of queries: 8318 |
83 | Correct | 3 ms | 376 KB | Output is correct |
84 | Partially correct | 38 ms | 248 KB | Partially correct - number of queries: 6817 |
85 | Partially correct | 65 ms | 504 KB | Partially correct - number of queries: 8372 |
86 | Incorrect | 62 ms | 316 KB | Incorrect |
87 | Halted | 0 ms | 0 KB | - |