답안 #942134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
942134 2024-03-10T09:44:09 Z sysia 게임 (APIO22_game) C++17
30 / 100
4000 ms 9960 KB
//Sylwia Sapkowska
#include "game.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
using namespace std;

void __print(int x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << "'" << x << "'";}
void __print(const char *x) {cerr << '"' << x << '"';}
void __print(const string &x) {cerr << '"' << x << '"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef pair<int, int> T;
const int oo2 = 1e9+7, K = 30;
const int mod = 998244353;
const int mx = 3e5+7;
int n, k;
vector<int>g[mx];
vector<int>vis;

void init(int _n, int _k) {
	n = _n, k = _k;
	for (int i = 0; i<=k-2; i++){
		debug(i, i+1);
		g[i].emplace_back(i+1);
	}
}

bool dfs(int v){
	vis[v] = 1;
	debug(v);
	for (auto x: g[v]){
		if (vis[x] == 1){
			if (x < k) {
				return true;
			} 
		} else if (!vis[x]) {
			if (dfs(x)) {
				return true;
			}
		}
	}
	vis[v] = 2;
	return false;
}


int add_teleporter(int u, int v) {
	debug(u, v);
	g[u].emplace_back(v);
	vis.assign(n, 0);
	auto curr = dfs(0);
	return (int)curr;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7256 KB Output is correct
3 Correct 2 ms 7256 KB Output is correct
4 Correct 2 ms 7256 KB Output is correct
5 Correct 3 ms 7460 KB Output is correct
6 Correct 2 ms 7256 KB Output is correct
7 Correct 3 ms 7256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7256 KB Output is correct
3 Correct 2 ms 7256 KB Output is correct
4 Correct 2 ms 7256 KB Output is correct
5 Correct 3 ms 7460 KB Output is correct
6 Correct 2 ms 7256 KB Output is correct
7 Correct 3 ms 7256 KB Output is correct
8 Correct 2 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 2 ms 7256 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 2 ms 7256 KB Output is correct
15 Correct 3 ms 7272 KB Output is correct
16 Correct 2 ms 7256 KB Output is correct
17 Correct 2 ms 7280 KB Output is correct
18 Correct 5 ms 7256 KB Output is correct
19 Correct 3 ms 7256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7256 KB Output is correct
3 Correct 2 ms 7256 KB Output is correct
4 Correct 2 ms 7256 KB Output is correct
5 Correct 3 ms 7460 KB Output is correct
6 Correct 2 ms 7256 KB Output is correct
7 Correct 3 ms 7256 KB Output is correct
8 Correct 2 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 2 ms 7256 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 2 ms 7256 KB Output is correct
15 Correct 3 ms 7272 KB Output is correct
16 Correct 2 ms 7256 KB Output is correct
17 Correct 2 ms 7280 KB Output is correct
18 Correct 5 ms 7256 KB Output is correct
19 Correct 3 ms 7256 KB Output is correct
20 Correct 2 ms 7256 KB Output is correct
21 Correct 3 ms 7256 KB Output is correct
22 Correct 3 ms 7512 KB Output is correct
23 Correct 2 ms 7512 KB Output is correct
24 Correct 7 ms 7512 KB Output is correct
25 Correct 23 ms 7768 KB Output is correct
26 Correct 25 ms 7512 KB Output is correct
27 Correct 32 ms 7768 KB Output is correct
28 Correct 14 ms 7768 KB Output is correct
29 Correct 27 ms 7524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7256 KB Output is correct
3 Correct 2 ms 7256 KB Output is correct
4 Correct 2 ms 7256 KB Output is correct
5 Correct 3 ms 7460 KB Output is correct
6 Correct 2 ms 7256 KB Output is correct
7 Correct 3 ms 7256 KB Output is correct
8 Correct 2 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 2 ms 7256 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 2 ms 7256 KB Output is correct
15 Correct 3 ms 7272 KB Output is correct
16 Correct 2 ms 7256 KB Output is correct
17 Correct 2 ms 7280 KB Output is correct
18 Correct 5 ms 7256 KB Output is correct
19 Correct 3 ms 7256 KB Output is correct
20 Correct 2 ms 7256 KB Output is correct
21 Correct 3 ms 7256 KB Output is correct
22 Correct 3 ms 7512 KB Output is correct
23 Correct 2 ms 7512 KB Output is correct
24 Correct 7 ms 7512 KB Output is correct
25 Correct 23 ms 7768 KB Output is correct
26 Correct 25 ms 7512 KB Output is correct
27 Correct 32 ms 7768 KB Output is correct
28 Correct 14 ms 7768 KB Output is correct
29 Correct 27 ms 7524 KB Output is correct
30 Correct 115 ms 8016 KB Output is correct
31 Correct 64 ms 8024 KB Output is correct
32 Correct 83 ms 9112 KB Output is correct
33 Correct 55 ms 8796 KB Output is correct
34 Correct 1002 ms 9960 KB Output is correct
35 Execution timed out 4033 ms 9028 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7256 KB Output is correct
3 Correct 2 ms 7256 KB Output is correct
4 Correct 2 ms 7256 KB Output is correct
5 Correct 3 ms 7460 KB Output is correct
6 Correct 2 ms 7256 KB Output is correct
7 Correct 3 ms 7256 KB Output is correct
8 Correct 2 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 2 ms 7256 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 2 ms 7256 KB Output is correct
15 Correct 3 ms 7272 KB Output is correct
16 Correct 2 ms 7256 KB Output is correct
17 Correct 2 ms 7280 KB Output is correct
18 Correct 5 ms 7256 KB Output is correct
19 Correct 3 ms 7256 KB Output is correct
20 Correct 2 ms 7256 KB Output is correct
21 Correct 3 ms 7256 KB Output is correct
22 Correct 3 ms 7512 KB Output is correct
23 Correct 2 ms 7512 KB Output is correct
24 Correct 7 ms 7512 KB Output is correct
25 Correct 23 ms 7768 KB Output is correct
26 Correct 25 ms 7512 KB Output is correct
27 Correct 32 ms 7768 KB Output is correct
28 Correct 14 ms 7768 KB Output is correct
29 Correct 27 ms 7524 KB Output is correct
30 Correct 115 ms 8016 KB Output is correct
31 Correct 64 ms 8024 KB Output is correct
32 Correct 83 ms 9112 KB Output is correct
33 Correct 55 ms 8796 KB Output is correct
34 Correct 1002 ms 9960 KB Output is correct
35 Execution timed out 4033 ms 9028 KB Time limit exceeded
36 Halted 0 ms 0 KB -