#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
namespace
{
int seq[]={1,0,1,1,0,0},dist[20005];
vector<pair<int,int> > v[20005];
vector<int> ans;
}
void dfs(int node,int p,int idx,int gp)
{
int c=(int)v[node].size()-(p!=-1);
for (auto u:v[node])
{
if (u.first!=p)
{
if (c==1)
{
ans[u.second]=seq[idx];
dfs(u.first,node,(idx+1)%6,seq[idx]);
}
else
{
ans[u.second]=!gp;
dfs(u.first,node,0,!gp);
}
}
}
}
vector<int> Mark(int n,int m,int A,int B,vector<int> a,vector<int> b)
{
for (int i=0;i<m;i++)
{
v[a[i]].push_back({b[i],i});
v[b[i]].push_back({a[i],i});
}
ans=vector<int>(m,-1);
if (A==2)
dfs(0,-1,0,0);
else
{
memset(dist,-1,sizeof(dist));
queue<int> q;
q.push(0);
dist[0]=0;
while (!q.empty())
{
int node=q.front();
q.pop();
for (auto u:v[node])
{
if (dist[u.first]==-1)
{
dist[u.first]=dist[node]+1;
q.push(u.first);
}
if (ans[u.second]==-1)
ans[u.second]=dist[node]%3;
}
}
}
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace
{
bool f;
int l,seq[]={1,0,1,1,0,0};
vector<int> p;
}
void Init(int A, int B){}
int Move(vector<int> y)
{
if (y.size()==3)
{
if ((bool)y[0]+(bool)y[1]+(bool)y[2]==1)
{
for (int i=0;i<3;i++)
{
if (y[i])
return i;
}
}
for (int i=0;i<3;i++)
{
if (!y[i])
return (i+1)%3;
}
}
if (!f)
{
f=1;
bool b=(y[0]>y[1]);
if (!y[b])
b^=1;
if (y[0]+y[1]==2)
p.push_back(b);
return l=b;
}
if (!y[0] && !y[1])
{
p.clear();
return -1;
}
if (p.size()==6)
{
for (int i=0;i<6;i++)
{
bool eq=1;
for (int j=0;j<6;j++)
eq&=(p[(i+j)%6]==seq[j]);
if (eq)
{
p.clear();
return -1;
}
}
}
if (y[0]+y[1]==1)
{
p.push_back(y[1]);
return l=y[1];
}
p.clear();
if (!y[l])
return -1;
l^=1;
return l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
16064 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
16064 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
13780 KB |
Output is correct |
2 |
Correct |
2 ms |
1792 KB |
Output is correct |
3 |
Correct |
40 ms |
13192 KB |
Output is correct |
4 |
Correct |
65 ms |
15132 KB |
Output is correct |
5 |
Correct |
63 ms |
15396 KB |
Output is correct |
6 |
Correct |
47 ms |
13872 KB |
Output is correct |
7 |
Correct |
48 ms |
14004 KB |
Output is correct |
8 |
Correct |
58 ms |
14284 KB |
Output is correct |
9 |
Correct |
57 ms |
14456 KB |
Output is correct |
10 |
Correct |
58 ms |
14172 KB |
Output is correct |
11 |
Correct |
54 ms |
14428 KB |
Output is correct |
12 |
Correct |
52 ms |
14164 KB |
Output is correct |
13 |
Correct |
52 ms |
14036 KB |
Output is correct |
14 |
Correct |
58 ms |
14420 KB |
Output is correct |
15 |
Correct |
58 ms |
14552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
13780 KB |
Output is correct |
2 |
Correct |
2 ms |
1792 KB |
Output is correct |
3 |
Correct |
40 ms |
13192 KB |
Output is correct |
4 |
Correct |
65 ms |
15132 KB |
Output is correct |
5 |
Correct |
63 ms |
15396 KB |
Output is correct |
6 |
Correct |
47 ms |
13872 KB |
Output is correct |
7 |
Correct |
48 ms |
14004 KB |
Output is correct |
8 |
Correct |
58 ms |
14284 KB |
Output is correct |
9 |
Correct |
57 ms |
14456 KB |
Output is correct |
10 |
Correct |
58 ms |
14172 KB |
Output is correct |
11 |
Correct |
54 ms |
14428 KB |
Output is correct |
12 |
Correct |
52 ms |
14164 KB |
Output is correct |
13 |
Correct |
52 ms |
14036 KB |
Output is correct |
14 |
Correct |
58 ms |
14420 KB |
Output is correct |
15 |
Correct |
58 ms |
14552 KB |
Output is correct |
16 |
Correct |
45 ms |
12228 KB |
Output is correct |
17 |
Correct |
41 ms |
12356 KB |
Output is correct |
18 |
Correct |
45 ms |
12176 KB |
Output is correct |
19 |
Correct |
44 ms |
12248 KB |
Output is correct |
20 |
Correct |
53 ms |
12772 KB |
Output is correct |
21 |
Correct |
48 ms |
12492 KB |
Output is correct |
22 |
Correct |
56 ms |
14412 KB |
Output is correct |
23 |
Correct |
45 ms |
12108 KB |
Output is correct |
24 |
Correct |
49 ms |
12400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
2 ms |
1536 KB |
Output is correct |
4 |
Correct |
2 ms |
1792 KB |
Output is correct |
5 |
Correct |
2 ms |
1792 KB |
Output is correct |
6 |
Correct |
2 ms |
1792 KB |
Output is correct |
7 |
Correct |
2 ms |
1792 KB |
Output is correct |
8 |
Correct |
2 ms |
1792 KB |
Output is correct |
9 |
Correct |
2 ms |
1792 KB |
Output is correct |
10 |
Correct |
2 ms |
1856 KB |
Output is correct |
11 |
Correct |
2 ms |
1792 KB |
Output is correct |
12 |
Correct |
2 ms |
1792 KB |
Output is correct |
13 |
Correct |
2 ms |
1792 KB |
Output is correct |
14 |
Correct |
2 ms |
1792 KB |
Output is correct |
15 |
Correct |
2 ms |
1792 KB |
Output is correct |
16 |
Correct |
2 ms |
1792 KB |
Output is correct |
17 |
Correct |
2 ms |
1792 KB |
Output is correct |
18 |
Correct |
2 ms |
1792 KB |
Output is correct |
19 |
Correct |
2 ms |
2048 KB |
Output is correct |
20 |
Correct |
2 ms |
1792 KB |
Output is correct |
21 |
Correct |
2 ms |
1792 KB |
Output is correct |
22 |
Correct |
2 ms |
1792 KB |
Output is correct |
23 |
Correct |
2 ms |
1792 KB |
Output is correct |
24 |
Correct |
2 ms |
1792 KB |
Output is correct |
25 |
Correct |
2 ms |
1792 KB |
Output is correct |
26 |
Correct |
2 ms |
1792 KB |
Output is correct |
27 |
Correct |
2 ms |
1792 KB |
Output is correct |
28 |
Correct |
2 ms |
1792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
11952 KB |
Output is correct |
2 |
Correct |
54 ms |
13004 KB |
Output is correct |
3 |
Correct |
1 ms |
1536 KB |
Output is correct |
4 |
Correct |
38 ms |
11432 KB |
Output is correct |
5 |
Correct |
73 ms |
14544 KB |
Output is correct |
6 |
Correct |
64 ms |
14652 KB |
Output is correct |
7 |
Correct |
46 ms |
13652 KB |
Output is correct |
8 |
Correct |
46 ms |
13868 KB |
Output is correct |
9 |
Correct |
58 ms |
14544 KB |
Output is correct |
10 |
Correct |
57 ms |
14628 KB |
Output is correct |
11 |
Correct |
58 ms |
14672 KB |
Output is correct |
12 |
Correct |
59 ms |
14544 KB |
Output is correct |
13 |
Correct |
58 ms |
14544 KB |
Output is correct |
14 |
Correct |
58 ms |
14548 KB |
Output is correct |
15 |
Correct |
58 ms |
14540 KB |
Output is correct |
16 |
Correct |
58 ms |
14540 KB |
Output is correct |
17 |
Correct |
54 ms |
14388 KB |
Output is correct |
18 |
Correct |
54 ms |
14176 KB |
Output is correct |
19 |
Correct |
54 ms |
14452 KB |
Output is correct |
20 |
Correct |
54 ms |
14292 KB |
Output is correct |
21 |
Correct |
57 ms |
14156 KB |
Output is correct |
22 |
Correct |
55 ms |
14388 KB |
Output is correct |
23 |
Correct |
43 ms |
11988 KB |
Output is correct |
24 |
Correct |
45 ms |
11732 KB |
Output is correct |
25 |
Correct |
48 ms |
12496 KB |
Output is correct |
26 |
Correct |
46 ms |
12372 KB |
Output is correct |
27 |
Correct |
51 ms |
13188 KB |
Output is correct |
28 |
Correct |
55 ms |
13320 KB |
Output is correct |
29 |
Correct |
55 ms |
13164 KB |
Output is correct |
30 |
Correct |
52 ms |
13140 KB |
Output is correct |
31 |
Correct |
46 ms |
11884 KB |
Output is correct |
32 |
Correct |
44 ms |
11860 KB |
Output is correct |
33 |
Correct |
44 ms |
12492 KB |
Output is correct |
34 |
Correct |
44 ms |
12472 KB |
Output is correct |
35 |
Correct |
54 ms |
13144 KB |
Output is correct |
36 |
Correct |
55 ms |
13532 KB |
Output is correct |
37 |
Correct |
50 ms |
13236 KB |
Output is correct |
38 |
Correct |
52 ms |
13112 KB |
Output is correct |
39 |
Correct |
57 ms |
13288 KB |
Output is correct |
40 |
Correct |
52 ms |
13260 KB |
Output is correct |
41 |
Correct |
54 ms |
13676 KB |
Output is correct |
42 |
Correct |
55 ms |
13676 KB |
Output is correct |
43 |
Correct |
54 ms |
13672 KB |
Output is correct |
44 |
Correct |
57 ms |
13796 KB |
Output is correct |
45 |
Correct |
56 ms |
13804 KB |
Output is correct |
46 |
Correct |
58 ms |
13700 KB |
Output is correct |
47 |
Correct |
65 ms |
12940 KB |
Output is correct |
48 |
Correct |
50 ms |
13072 KB |
Output is correct |
49 |
Correct |
61 ms |
12816 KB |
Output is correct |
50 |
Correct |
57 ms |
12884 KB |
Output is correct |
51 |
Correct |
44 ms |
12336 KB |
Output is correct |
52 |
Correct |
47 ms |
12108 KB |
Output is correct |
53 |
Correct |
46 ms |
12332 KB |
Output is correct |
54 |
Correct |
44 ms |
12332 KB |
Output is correct |
55 |
Correct |
47 ms |
12488 KB |
Output is correct |
56 |
Correct |
46 ms |
12336 KB |
Output is correct |
57 |
Correct |
45 ms |
12372 KB |
Output is correct |
58 |
Correct |
45 ms |
12372 KB |
Output is correct |
59 |
Correct |
49 ms |
12136 KB |
Output is correct |
60 |
Correct |
45 ms |
11996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
11728 KB |
Output is correct |
2 |
Correct |
59 ms |
12936 KB |
Output is correct |
3 |
Correct |
1 ms |
1536 KB |
Output is correct |
4 |
Correct |
39 ms |
11568 KB |
Output is correct |
5 |
Correct |
65 ms |
14556 KB |
Output is correct |
6 |
Correct |
61 ms |
14540 KB |
Output is correct |
7 |
Correct |
48 ms |
13868 KB |
Output is correct |
8 |
Correct |
48 ms |
13516 KB |
Output is correct |
9 |
Correct |
58 ms |
14552 KB |
Output is correct |
10 |
Correct |
65 ms |
14680 KB |
Output is correct |
11 |
Correct |
59 ms |
14796 KB |
Output is correct |
12 |
Correct |
58 ms |
14552 KB |
Output is correct |
13 |
Correct |
58 ms |
14548 KB |
Output is correct |
14 |
Correct |
59 ms |
14764 KB |
Output is correct |
15 |
Incorrect |
58 ms |
14540 KB |
Wrong Answer [6] |
16 |
Halted |
0 ms |
0 KB |
- |