# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
641736 | 2022-09-17T13:58:50 Z | Vladth11 | The Potion of Great Power (CEOI20_potion) | C++14 | 3000 ms | 26152 KB |
#include <bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " using namespace std; typedef long long ll; typedef pair <int, int> pii; const int NMAX = 100001; const int VMAX = 101; const int INF = 2e9; const int MOD = 1000000007; const int BLOCK = 447; const int base = 117; const int nr_of_bits = 24; const int inv2 = 500000004; set <int> events[NMAX]; int a[NMAX]; void init(int N, int D, int H[]) { for(int i = 0; i < N; i++){ a[i] = H[i]; } } void baga(int a, int b){ if(events[a].find(b) == events[a].end()) events[a].insert(b); else events[a].erase(b); } void curseChanges(int U, int A[], int B[]) { for(int i = 0; i < U; i++){ baga(A[i], B[i]); baga(B[i], A[i]); } } int question(int x, int y, int v) { set <int> stX = events[x], stY = events[y]; int last, ultim = -1; int minim = 1e9; if(stX.size() == 0 || stY.size() == 0) return minim; set <int> nou; for(auto p : stX){ nou.insert(a[p]); } for(auto p : stY){ int val = a[p]; auto it = nou.lower_bound(val); if(it != nou.end()){ minim = min(minim, abs((*it) - val)); } it = nou.upper_bound(val); if(it != nou.begin()){ it = prev(it); minim = min(minim, abs((*it) - val)); } } return minim; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4944 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 5072 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 270 ms | 26028 KB | Output is correct |
2 | Correct | 289 ms | 26136 KB | Output is correct |
3 | Correct | 185 ms | 7396 KB | Output is correct |
4 | Execution timed out | 3041 ms | 15896 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 195 ms | 26152 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 6104 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4944 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |