답안 #746867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
746867 2023-05-23T07:42:10 Z tutis 게임 (APIO22_game) C++17
2 / 100
11 ms 14416 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 < k; i++)
		mx[i] = i;
	for (int i = k; i < n; i++)
		mx[i] = -1;
}

int add_teleporter(int u, int v) {
	int x = min(v, mn[v]);
	int y = mx[u];
	if (y >= x)
		return 1;
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14288 KB Output is correct
2 Correct 10 ms 14288 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 9 ms 14380 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14288 KB Output is correct
2 Correct 10 ms 14288 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 9 ms 14380 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 9 ms 14288 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Incorrect 8 ms 14404 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14288 KB Output is correct
2 Correct 10 ms 14288 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 9 ms 14380 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 9 ms 14288 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Incorrect 8 ms 14404 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14288 KB Output is correct
2 Correct 10 ms 14288 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 9 ms 14380 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 9 ms 14288 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Incorrect 8 ms 14404 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14288 KB Output is correct
2 Correct 10 ms 14288 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 9 ms 14380 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 11 ms 14288 KB Output is correct
8 Correct 9 ms 14288 KB Output is correct
9 Correct 8 ms 14288 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Incorrect 8 ms 14404 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -