# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
54021 | 2018-07-02T08:30:39 Z | chpipis | 커다란 상품 (IOI17_prize) | C++11 | 86 ms | 1616 KB |
#include "prize.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; int num_q; map<int, vi> memo; vi query(int x) { if (memo.count(x)) return memo[x]; num_q++; vi ret = ask(x); return memo[x] = ret; } int find_best(int n) { memo.clear(); num_q = 0; for (int i = 0, j; i < n; i = j + 1) { if (i == n - 1) return i; j = i; vi cur = query(i); if (cur[0] + cur[1] == 0) return i; int lo = i + 1, hi = n - 1; while (lo <= hi) { int mid = (lo + hi) >> 1; vi now = query(mid); if (now[0] + now[1] == 0) return mid; if (now == cur) { lo = mid + 1; j = mid; } else { hi = mid - 1; } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 288 KB | Output is correct |
2 | Correct | 3 ms | 436 KB | Output is correct |
3 | Correct | 3 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 544 KB | Output is correct |
5 | Correct | 2 ms | 544 KB | Output is correct |
6 | Correct | 2 ms | 544 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
9 | Correct | 3 ms | 544 KB | Output is correct |
10 | Correct | 2 ms | 556 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 560 KB | Output is correct |
2 | Correct | 3 ms | 560 KB | Output is correct |
3 | Correct | 3 ms | 560 KB | Output is correct |
4 | Correct | 3 ms | 560 KB | Output is correct |
5 | Correct | 3 ms | 560 KB | Output is correct |
6 | Correct | 3 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 560 KB | Output is correct |
8 | Correct | 2 ms | 560 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 3 ms | 568 KB | Output is correct |
11 | Correct | 7 ms | 572 KB | Output is correct |
12 | Correct | 2 ms | 572 KB | Output is correct |
13 | Correct | 11 ms | 572 KB | Output is correct |
14 | Correct | 6 ms | 700 KB | Output is correct |
15 | Correct | 13 ms | 792 KB | Output is correct |
16 | Incorrect | 86 ms | 1616 KB | Incorrect |
17 | Halted | 0 ms | 0 KB | - |