Submission #588955

# Submission time Handle Problem Language Result Execution time Memory
588955 2022-07-04T08:11:26 Z Arnch The Potion of Great Power (CEOI20_potion) C++17
0 / 100
51 ms 8444 KB
#include<bits/stdc++.h>
using namespace std;

const int N = 1e3 + 10, maxn = 1e6 + 10;

int n, d, h[maxn], a[maxn], b[maxn];
set<int> st[N];

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];
	}

	for(int i = 0; i < U; i++) {
		auto it = st[a[i]].find(b[i]);
		if(*it == b[i]) st[a[i]].erase(b[i]);
		else st[a[i]].insert(b[i]);

		it = st[b[i]].find(a[i]);
		if(*it == a[i]) st[b[i]].erase(a[i]);
		else st[b[i]].insert(a[i]);
	}
}

int question(int x, int y, int v) {
	int ans = 1e9;
	for(auto it : st[x]) {
		for(auto it2 : st[y]) {
			ans = min(ans, abs(h[it] - h[it2]));
		}
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 464 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 51 ms 8444 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 43 ms 8440 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1052 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB Incorrect
2 Halted 0 ms 0 KB -