# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
149330 |
2019-09-01T06:15:52 Z |
rkm0959(#3623, jun6873, babo) |
Bulb Game (FXCUP4_bulb) |
C++17 |
|
72 ms |
7828 KB |
#include <bits/stdc++.h>
using namespace std;
bool bad(int x, vector<int>&L, vector<int>&R){
x=R[x];
while(x>=0)
x=L[x];
return x==-2;
}
bool ok(int x, vector<int>&L, vector<int>&R){
x=R[x];
while(x>=0)
{
if(bad(x,L,R)) return 0;
x=L[x];
}
return x==-1;
}
bool existover2(int now,int dep, vector<int>&L, vector<int>&R){
if(now<0) return 0;
if(dep>2) return 1;
return existover2(L[now],dep,L,R) or existover2(R[now],dep+1,L,R);
}
bool changeok(int now, vector<int>&L, vector<int>&R){
now=R[now];
while(now>=0) now=L[now];
return now==-1;
}
bool checkgo(int now, vector<int>&L, vector<int>&R){
int temp=L[now];
while(temp>=0)
{
if(bad(temp,L,R)) return 0;
temp=L[temp];
}
now=R[now];
while(now>=0)
{
if(changeok(now,L,R)) return 1;
now=L[now];
}
return 0;
}
int FindWinner(int T, vector<int>L, vector<int>R){
if(L.size()==1) return L[0]==-1;
int i;
int temp=0;
while(temp>=0)
temp=L[temp];
if(temp==-2) return 0;
temp=0;
while(temp>=0)
{
if(ok(temp,L,R)) return 1;
if(bad(temp,L,R)) return checkgo(temp,L,R);
temp=L[temp];
}
return existover2(0,0,L,R);
}
Compilation message
bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:52:6: warning: unused variable 'i' [-Wunused-variable]
int i;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
352 KB |
Output is correct |
2 |
Correct |
2 ms |
292 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 |
252 KB |
Output is correct |
6 |
Correct |
2 ms |
380 KB |
Output is correct |
7 |
Correct |
2 ms |
368 KB |
Output is correct |
8 |
Correct |
2 ms |
424 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
248 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
352 KB |
Output is correct |
4 |
Correct |
2 ms |
292 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
252 KB |
Output is correct |
8 |
Correct |
2 ms |
380 KB |
Output is correct |
9 |
Correct |
2 ms |
368 KB |
Output is correct |
10 |
Correct |
2 ms |
424 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
248 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
372 KB |
Output is correct |
19 |
Correct |
2 ms |
400 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
292 KB |
Output is correct |
23 |
Correct |
2 ms |
364 KB |
Output is correct |
24 |
Correct |
2 ms |
256 KB |
Output is correct |
25 |
Correct |
2 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
352 KB |
Output is correct |
4 |
Correct |
2 ms |
292 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
252 KB |
Output is correct |
8 |
Correct |
2 ms |
380 KB |
Output is correct |
9 |
Correct |
2 ms |
368 KB |
Output is correct |
10 |
Correct |
2 ms |
424 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
248 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
372 KB |
Output is correct |
19 |
Correct |
2 ms |
400 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
292 KB |
Output is correct |
23 |
Correct |
2 ms |
364 KB |
Output is correct |
24 |
Correct |
2 ms |
256 KB |
Output is correct |
25 |
Correct |
2 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
71 ms |
7056 KB |
Output is correct |
28 |
Correct |
72 ms |
7432 KB |
Output is correct |
29 |
Correct |
71 ms |
7416 KB |
Output is correct |
30 |
Correct |
72 ms |
6552 KB |
Output is correct |
31 |
Correct |
72 ms |
7828 KB |
Output is correct |
32 |
Correct |
70 ms |
5752 KB |
Output is correct |
33 |
Correct |
71 ms |
7688 KB |
Output is correct |
34 |
Correct |
71 ms |
7800 KB |
Output is correct |
35 |
Correct |
71 ms |
6780 KB |
Output is correct |
36 |
Correct |
71 ms |
7160 KB |
Output is correct |
37 |
Correct |
71 ms |
6776 KB |
Output is correct |
38 |
Correct |
71 ms |
7544 KB |
Output is correct |
39 |
Correct |
71 ms |
7800 KB |
Output is correct |
40 |
Correct |
70 ms |
5644 KB |
Output is correct |
41 |
Correct |
71 ms |
6156 KB |
Output is correct |
42 |
Correct |
71 ms |
7416 KB |
Output is correct |
43 |
Correct |
71 ms |
7796 KB |
Output is correct |
44 |
Correct |
72 ms |
7528 KB |
Output is correct |
45 |
Correct |
71 ms |
6284 KB |
Output is correct |
46 |
Correct |
71 ms |
7180 KB |
Output is correct |
47 |
Correct |
71 ms |
5644 KB |
Output is correct |
48 |
Correct |
71 ms |
6556 KB |
Output is correct |
49 |
Correct |
71 ms |
7544 KB |
Output is correct |
50 |
Correct |
70 ms |
4984 KB |
Output is correct |