Submission #588929

# Submission time Handle Problem Language Result Execution time Memory
588929 2022-07-04T07:53:13 Z Arnch The Potion of Great Power (CEOI20_potion) C++17
0 / 100
288 ms 4468 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];
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) {
	set<int> stx, sty;
	for(int i = 0; i < v; i++) {
		if(a[i] == x && b[i] == y) return 0;
		if(b[i] == x && a[i] == y) return 0;
	
		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]);
			}
			continue;
		}

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

	for(int i = 0; i < v; i++) {
		mark[a[i]] = mark[b[i]] = 0;
		mark2[a[i]] = mark2[b[i]] = 0;
	}

	int ans = 1e9;
	for(auto it : stx) 
		for(auto it2 : sty) {
			ans = min(ans, abs(it - 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 336 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 288 ms 4468 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 86 ms 4460 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 464 KB Incorrect
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 -