Submission #740955

# Submission time Handle Problem Language Result Execution time Memory
740955 2023-05-13T10:25:39 Z dubabuba Game (APIO22_game) C++17
0 / 100
14 ms 8476 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
#define ff first
#define ss second
#define MP make_pair

const int mxn = 3e5 + 10;
vector<int> adj[mxn];
int n, k, vis[mxn];

bool dfs(int u) {
	vis[u] = 2;
	for(int v : adj[u]) {
		if(vis[v] == 2) return 1;
		bool e = 0;
		if(!vis[v])
			e = dfs(v);
		if(e) return 1;
	}
	vis[u] = 1;
	return 0;
}

void init(int n, int k) {
	::n = n;
	::k = k;
}

int add_teleporter(int u, int v) {
	adj[u].push_back(v);
	memset(vis, 0, sizeof vis);
	for(int i = 0; i < k; i++)
	if(dfs(i))
		return 1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 8 ms 8400 KB Output is correct
3 Correct 14 ms 8476 KB Output is correct
4 Incorrect 11 ms 8400 KB Wrong Answer[1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 8 ms 8400 KB Output is correct
3 Correct 14 ms 8476 KB Output is correct
4 Incorrect 11 ms 8400 KB Wrong Answer[1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 8 ms 8400 KB Output is correct
3 Correct 14 ms 8476 KB Output is correct
4 Incorrect 11 ms 8400 KB Wrong Answer[1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 8 ms 8400 KB Output is correct
3 Correct 14 ms 8476 KB Output is correct
4 Incorrect 11 ms 8400 KB Wrong Answer[1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 8 ms 8400 KB Output is correct
3 Correct 14 ms 8476 KB Output is correct
4 Incorrect 11 ms 8400 KB Wrong Answer[1]
5 Halted 0 ms 0 KB -