# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
27477 | 2017-07-13T06:23:03 Z | 김동현(#1155) | OGLEDALA (COI15_ogledala) | C++14 | 4000 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; int n, q; ll m, a[100010]; priority_queue<pll> pq; int main(){ scanf("%lld%d%d", &m, &n, &q); for(int i = 1; i <= n; i++) scanf("%lld", a + i); a[n + 1] = m + 1; for(int i = 1; i <= n + 1; i++){ pq.push({a[i] - a[i - 1] - 1, -(a[i - 1] + 1)}); } for(int i = 1, c; q--; ){ scanf("%d", &c); for(; i < c; i++){ if(i <= n) continue; ll l, x; tie(l, x) = pq.top(); x = -x; if((l - 1) / 2 > 0) pq.push({(l - 1) / 2, -x}); if(l / 2 > 0) pq.push({l / 2, -(x + (l + 1) / 2)}); pq.pop(); } if(i <= n){ printf("%lld\n", a[i]); continue; } ll l, x; tie(l, x) = pq.top(); x = -x; printf("%lld\n", x + (l - 1) / 2); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2800 KB | Output is correct |
2 | Correct | 0 ms | 2800 KB | Output is correct |
3 | Correct | 46 ms | 4420 KB | Output is correct |
4 | Correct | 39 ms | 4420 KB | Output is correct |
5 | Correct | 99 ms | 9028 KB | Output is correct |
6 | Correct | 103 ms | 9028 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 15176 KB | Output is correct |
2 | Correct | 53 ms | 15180 KB | Output is correct |
3 | Correct | 103 ms | 15172 KB | Output is correct |
4 | Correct | 86 ms | 15172 KB | Output is correct |
5 | Correct | 109 ms | 15172 KB | Output is correct |
6 | Correct | 113 ms | 15172 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4000 ms | 524288 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |