제출 #846357

#제출 시각아이디문제언어결과실행 시간메모리
846357vjudge1OGLEDALA (COI15_ogledala)C++17
41 / 100
2744 ms524288 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); #define s second #define f first typedef long long ll; #define int long long const ll MOD = 998244353; const ll LOGN = 20; const ll MAXN = 3e5 + 5; vector<int> A; signed main() { fast int M, N, Q; cin >> M >> N >> Q; A = vector<int>(N+2); for (int i = 1; i <= N; i++) cin >> A[i]; A[0] = 0; A[N+1] = M+1; priority_queue<pair<int, pair<int,int>>> pq; for (int i = 1; i <= N+1; i++) pq.push({A[i]-A[i-1]-1, {-A[i-1]-1, -A[i]+1}}); int now = N; int now_ans = A[N]; for (int i = 1; i <= Q; i++) { int k; cin >> k; if (k <= N) cout << A[k] << "\n"; else { while (N < k) { pair<int,pair<int,int>> p = pq.top(); pq.pop(); pair<int,pair<int,int>> q = {p.f, {-p.s.f, -p.s.s}}; now_ans = (q.s.f + q.s.s) / 2; pq.push({now_ans-q.s.f, {-(q.s.f), -(now_ans - 1)}}); pq.push({q.s.s - now_ans, {-(now_ans+1), -(q.s.s)}}); N++; } cout << now_ans << "\n"; } } }

컴파일 시 표준 에러 (stderr) 메시지

ogledala.cpp: In function 'int main()':
ogledala.cpp:28:6: warning: unused variable 'now' [-Wunused-variable]
   28 |  int now = N;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...