#include "bulb.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed;cout.precision(a)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9;
const ll INF = 1e18;
int n;
vector<int> l, r;
int dfs(int x) {
if(x < 0) return x;
return dfs(l[x]);
}
int FindWinner(int T, std::vector<int> L, std::vector<int> R){
n = L.size();
l = L;
r = R;
bool flag;
for(int i=0; i<n; i++) {
swap(l[i], r[i]);
flag = true;
int cnt = 0;
for(int j=0; j>=0; j = l[j], cnt++) {
if(dfs(r[j]) == -2) flag = false;
}
if(cnt < n && dfs(0) == -2) flag = false;
swap(l[i], r[i]);
if(flag) return 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 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 |
376 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 |
348 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 |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
252 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 |
376 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 |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
348 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 |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 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 |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
252 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 |
376 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 |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
348 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 |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 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 |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
348 KB |
Output is correct |
27 |
Correct |
104 ms |
7320 KB |
Output is correct |
28 |
Correct |
75 ms |
7320 KB |
Output is correct |
29 |
Correct |
87 ms |
7288 KB |
Output is correct |
30 |
Correct |
73 ms |
7288 KB |
Output is correct |
31 |
Correct |
73 ms |
7324 KB |
Output is correct |
32 |
Correct |
92 ms |
7288 KB |
Output is correct |
33 |
Correct |
72 ms |
7288 KB |
Output is correct |
34 |
Correct |
107 ms |
7340 KB |
Output is correct |
35 |
Correct |
93 ms |
7320 KB |
Output is correct |
36 |
Correct |
89 ms |
7288 KB |
Output is correct |
37 |
Correct |
88 ms |
7288 KB |
Output is correct |
38 |
Correct |
103 ms |
7336 KB |
Output is correct |
39 |
Correct |
73 ms |
7320 KB |
Output is correct |
40 |
Correct |
72 ms |
7288 KB |
Output is correct |
41 |
Correct |
98 ms |
7288 KB |
Output is correct |
42 |
Correct |
95 ms |
7288 KB |
Output is correct |
43 |
Correct |
92 ms |
7388 KB |
Output is correct |
44 |
Correct |
86 ms |
7320 KB |
Output is correct |
45 |
Correct |
93 ms |
7324 KB |
Output is correct |
46 |
Correct |
73 ms |
7328 KB |
Output is correct |
47 |
Correct |
76 ms |
7288 KB |
Output is correct |
48 |
Correct |
84 ms |
7340 KB |
Output is correct |
49 |
Correct |
73 ms |
7324 KB |
Output is correct |
50 |
Correct |
75 ms |
7320 KB |
Output is correct |