Submission #150540

# Submission time Handle Problem Language Result Execution time Memory
150540 2019-09-01T08:36:35 Z ----MIT합격선----(#3601, maruii, Diuven, andy627) Bulb Game (FXCUP4_bulb) C++17
100 / 100
73 ms 8340 KB
#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> L, R;

int f(int x, int c) {
	if (c == 0) {
		if (x < 0) return 1;
		if (f(R[x], 1)) return 1;
		int y = R[x];
		while (y >= 0) y = L[y];
		if (y != -1) return 0;
		return f(L[x], c);
	}
	if (c == 1) {
		if (x < 0) return 1;
		if (f(R[x], 2) == 0) return 0;
		return f(L[x], 1);
	}
	if (c == 2) {
		if (x < 0) return x == -1;
		return f(L[x], 2);
	}
}

int FindWinner(int T, std::vector<int> LL, std::vector<int> RR){
	L = LL, R = RR;
	N = L.size();
	int x = 0;
	while (x >= 0) x = L[x];
	if (x == -2) return 0;
	return f(0, 0);
}

Compilation message

bulb.cpp: In function 'int f(int, int)':
bulb.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 424 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 292 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 252 KB Output is correct
25 Correct 2 ms 400 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 424 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 292 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 252 KB Output is correct
25 Correct 2 ms 400 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 73 ms 8332 KB Output is correct
28 Correct 73 ms 8312 KB Output is correct
29 Correct 73 ms 8336 KB Output is correct
30 Correct 73 ms 8056 KB Output is correct
31 Correct 73 ms 7772 KB Output is correct
32 Correct 72 ms 8164 KB Output is correct
33 Correct 72 ms 8220 KB Output is correct
34 Correct 72 ms 8184 KB Output is correct
35 Correct 73 ms 8240 KB Output is correct
36 Correct 73 ms 8224 KB Output is correct
37 Correct 73 ms 8208 KB Output is correct
38 Correct 73 ms 8284 KB Output is correct
39 Correct 73 ms 8216 KB Output is correct
40 Correct 72 ms 7928 KB Output is correct
41 Correct 73 ms 7900 KB Output is correct
42 Correct 72 ms 8208 KB Output is correct
43 Correct 73 ms 8224 KB Output is correct
44 Correct 73 ms 8220 KB Output is correct
45 Correct 73 ms 8212 KB Output is correct
46 Correct 73 ms 8340 KB Output is correct
47 Correct 73 ms 7840 KB Output is correct
48 Correct 73 ms 8228 KB Output is correct
49 Correct 72 ms 7324 KB Output is correct
50 Correct 73 ms 7336 KB Output is correct