# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1067375 | 2024-08-20T16:00:29 Z | Ignut | 커다란 상품 (IOI17_prize) | C++17 | 38 ms | 424 KB |
// Ignut #include <bits/stdc++.h> using namespace std; using ll = long long; vector<int> ask(int i); int Q = 0; int find_best(int n) { map<int, int> mp; int L = -1; while (L < n - 1) { int lo = L + 1, hi = n - 1; while (lo < hi) { int mid = lo + (hi - lo) / 2; Q ++; if (Q == 10000) { Q /= 0; } vector<int> vec = ask(mid); if (vec[0] + vec[1] == 0) return mid; int lvl = vec[0] + vec[1]; int comp = 0; for (auto [a, b] : mp) if (a < lvl) comp += b; if (vec[0] > comp) hi = mid - 1; else { lo = mid + 1; mp[lvl] ++; } } Q ++; if (Q == 10000) { Q /= 0; } vector<int> vec = ask(lo); if (vec[0] + vec[1] == 0) return lo; int lvl = vec[0] + vec[1]; mp[lvl] ++; L = lo; } return n - 1; } /* 8 3 2 3 1 3 3 2 3 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 344 KB | Output is correct |
12 | Correct | 1 ms | 368 KB | Output is correct |
13 | Runtime error | 38 ms | 424 KB | Execution killed with signal 4 |
14 | Halted | 0 ms | 0 KB | - |