Submission #746866

# Submission time Handle Problem Language Result Execution time Memory
746866 2023-05-23T07:37:47 Z tutis Game (APIO22_game) C++17
0 / 100
9 ms 14288 KB
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
const int N = 300000;
int K;

vector<int>adj_[N];
vector<int>adj[N];
int mn[N];
int mx[N];
void init(int n, int k) {
	K = k;
	for (int i = 0; i < n; i++)
		mn[i] = k;
	for (int i = 0; i < k; i++)
		mn[i] = i + 1;
	for (int i = 0; i < n; i++)
		mx[i] = i;
}

int add_teleporter(int u, int v) {
	if (mx[u] >= mn[u])
		return 1;
	int x = min(v, mn[v]);
	int y = mx[u];
	function<void(int)>dfs = [&](int i) {
		mn[i] = x;
		for (int j : adj_[i])
			if (mn[j] > x)
				dfs(j);
	};
	if (mn[u] > x)
		dfs(u);
	function<void(int)>dfs1 = [&](int i) {
		mx[i] = y;
		for (int j : adj[i])
			if (y > mx[j])
				dfs(j);
	};
	if (y > mx[v])
		dfs1(v);
	adj[u].push_back(v);
	adj_[v].push_back(u);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 14288 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 14288 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 14288 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 14288 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 14288 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -