제출 #846232

#제출 시각아이디문제언어결과실행 시간메모리
846232vjudge1OGLEDALA (COI15_ogledala)C++17
0 / 100
2346 ms524288 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 3e5 + 5, MOD = 1e9 + 7; map<ll, ll> ans; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n, m, asd; cin >> m >> n >> asd; vector<int> v; v.push_back(0); priority_queue<array<ll, 3>> q; for(int i = 0; i < n; i++) { int x; cin >> x; v.push_back(x); int l = x - v[i] - 1; if(l != 0) { q.push({l, -(v[i] + 1), -(x - 1)}); } } int l = (m + 1) - v[n] - 1; if(l != 0) { q.push({l, -(v[n] + 1), -((m + 1) - 1)}); } for(ll i = n + 1; i <= m; i++) { auto cur = q.top(); q.pop(); ll l = -cur[1], r = -cur[2]; ll mid = (l + r) / 2; ans[i] = mid; ll length = (mid - 1) - l + 1; if(length > 0) { q.push({length, -l, -(mid - 1)}); } length = r - (mid + 1) + 1; if(length > 0) { q.push({length, -(mid + 1), -r}); } } while(asd--) { int x; cin >> x; cout << ans[x] << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...