제출 #588942

#제출 시각아이디문제언어결과실행 시간메모리
588942ArnchThe Potion of Great Power (CEOI20_potion)C++17
17 / 100
3070 ms4548 KiB
#include<bits/stdc++.h> using namespace std; const int N = 1e3 + 10, maxn = 1e6 + 10; int n, d, h[maxn], a[maxn], b[maxn]; bool mark[maxn], mark2[maxn]; void init(int N, int D, int H[]) { n = N, d = D; for(int i = 0; i < n; i++) h[i] = H[i]; } void curseChanges(int U, int A[], int B[]) { for(int i = 0; i < U; i++) a[i] = A[i], b[i] = B[i]; } int question(int x, int y, int v) { for(int i = 0; i < v; i++) { mark[a[i]] = mark[b[i]] = 0; mark2[a[i]] = mark2[b[i]] = 0; } bool f = 0; set<int> stx, sty; for(int i = 0; i < v; i++) { if(b[i] == x) swap(a[i], b[i]); if(a[i] == x) { if(mark[b[i]]) { stx.erase(b[i]); mark[b[i]] = 0; } else { mark[b[i]] = 1; stx.insert(b[i]); } } if(b[i] == y) swap(a[i], b[i]); if(a[i] == y) { if(mark2[b[i]]) { sty.erase(b[i]); mark2[b[i]] = 0; } else { mark2[b[i]] = 1; sty.insert(b[i]); } continue; } } int ans = 1e9; for(auto it : stx) for(auto it2 : sty) { ans = min(ans, abs(h[it] - h[it2])); } return ans; }

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

potion.cpp: In function 'int question(int, int, int)':
potion.cpp:23:7: warning: unused variable 'f' [-Wunused-variable]
   23 |  bool f = 0;
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...