#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
namespace
{
int INF=1e9;
vector<int> muchii[20005];
vector<pii> g;
int dist[20005];
int n,m;
void bfs()
{
for(int i=0;i<n;i++)
dist[i]=INF;
dist[0]=0;
queue<int> coada;
coada.push(0);
while(!coada.empty())
{
int nod=coada.front();
coada.pop();
for(int i:muchii[nod])
if(dist[i]>dist[nod]+1)
{
dist[i]=dist[nod]+1;
coada.push(i);
}
}
}
int garbage(int x)
{
if(x%3==0)
return 0;
if(x%3==1)
return 1;
return 2;
}
vector<int> subtask14()
{
vector<int> sol;
for(int i=0;i<m;i++)
{
int a=g[i].first,b=g[i].second;
if(dist[a]>dist[b])
swap(a,b);
int val=garbage(dist[a]);
sol.push_back(val);
}
return sol;
}
}
vector<int> Mark(int N, int M, int A, int B,vector<int> U, vector<int> V)
{
n=N;
m=M;
for(int i=0;i<m;i++)
{
int a=U[i],b=V[i];
muchii[a].push_back(b);
muchii[b].push_back(a);
g.push_back({a,b});
}
bfs();
if(B==0)
{
vector<int> sol=subtask14();
return sol;
}
vector<int> emp;
return emp;
}
#include "Catherine.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace
{
bool penal;
}
void Init(int A, int B)
{
if(B==0)
penal=1;
}
int Move(vector<int> y)
{
if(penal)
{
int cnt=0;
for(int i=0;i<3;i++)
if(y[i]!=0)
cnt++;
if(cnt==1)
{
for(int i=0;i<3;i++)
if(y[i]>0)
return i;
}
if(y[0]>0&&y[1]>0)
return 0;
if(y[0]>0&&y[2]>0)
return 2;
return 1;
}
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
39 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
16276 KB |
Output is correct |
2 |
Correct |
1 ms |
1296 KB |
Output is correct |
3 |
Correct |
25 ms |
15364 KB |
Output is correct |
4 |
Correct |
43 ms |
17360 KB |
Output is correct |
5 |
Correct |
42 ms |
17344 KB |
Output is correct |
6 |
Correct |
26 ms |
16164 KB |
Output is correct |
7 |
Correct |
28 ms |
16076 KB |
Output is correct |
8 |
Correct |
37 ms |
16792 KB |
Output is correct |
9 |
Correct |
41 ms |
16664 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
16276 KB |
Output is correct |
2 |
Correct |
1 ms |
1296 KB |
Output is correct |
3 |
Correct |
25 ms |
15364 KB |
Output is correct |
4 |
Correct |
43 ms |
17360 KB |
Output is correct |
5 |
Correct |
42 ms |
17344 KB |
Output is correct |
6 |
Correct |
26 ms |
16164 KB |
Output is correct |
7 |
Correct |
28 ms |
16076 KB |
Output is correct |
8 |
Correct |
37 ms |
16792 KB |
Output is correct |
9 |
Correct |
41 ms |
16664 KB |
Output is correct |
10 |
Correct |
26 ms |
14276 KB |
Output is correct |
11 |
Correct |
26 ms |
14304 KB |
Output is correct |
12 |
Correct |
30 ms |
14236 KB |
Output is correct |
13 |
Correct |
28 ms |
14208 KB |
Output is correct |
14 |
Correct |
26 ms |
14448 KB |
Output is correct |
15 |
Correct |
28 ms |
14540 KB |
Output is correct |
16 |
Correct |
31 ms |
16864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
13796 KB |
Output is correct |
2 |
Correct |
1 ms |
1308 KB |
Output is correct |
3 |
Correct |
27 ms |
13236 KB |
Output is correct |
4 |
Correct |
36 ms |
15324 KB |
Output is correct |
5 |
Correct |
33 ms |
15320 KB |
Output is correct |
6 |
Correct |
28 ms |
13776 KB |
Output is correct |
7 |
Correct |
27 ms |
13744 KB |
Output is correct |
8 |
Correct |
30 ms |
14696 KB |
Output is correct |
9 |
Correct |
31 ms |
14672 KB |
Output is correct |
10 |
Correct |
27 ms |
14192 KB |
Output is correct |
11 |
Correct |
28 ms |
14228 KB |
Output is correct |
12 |
Correct |
27 ms |
14436 KB |
Output is correct |
13 |
Correct |
39 ms |
14632 KB |
Output is correct |
14 |
Correct |
30 ms |
14684 KB |
Output is correct |
15 |
Correct |
30 ms |
14404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
13796 KB |
Output is correct |
2 |
Correct |
1 ms |
1308 KB |
Output is correct |
3 |
Correct |
27 ms |
13236 KB |
Output is correct |
4 |
Correct |
36 ms |
15324 KB |
Output is correct |
5 |
Correct |
33 ms |
15320 KB |
Output is correct |
6 |
Correct |
28 ms |
13776 KB |
Output is correct |
7 |
Correct |
27 ms |
13744 KB |
Output is correct |
8 |
Correct |
30 ms |
14696 KB |
Output is correct |
9 |
Correct |
31 ms |
14672 KB |
Output is correct |
10 |
Correct |
27 ms |
14192 KB |
Output is correct |
11 |
Correct |
28 ms |
14228 KB |
Output is correct |
12 |
Correct |
27 ms |
14436 KB |
Output is correct |
13 |
Correct |
39 ms |
14632 KB |
Output is correct |
14 |
Correct |
30 ms |
14684 KB |
Output is correct |
15 |
Correct |
30 ms |
14404 KB |
Output is correct |
16 |
Correct |
24 ms |
12240 KB |
Output is correct |
17 |
Correct |
23 ms |
12236 KB |
Output is correct |
18 |
Correct |
25 ms |
12380 KB |
Output is correct |
19 |
Correct |
28 ms |
12340 KB |
Output is correct |
20 |
Correct |
27 ms |
12900 KB |
Output is correct |
21 |
Correct |
26 ms |
12564 KB |
Output is correct |
22 |
Correct |
31 ms |
14712 KB |
Output is correct |
23 |
Correct |
26 ms |
12312 KB |
Output is correct |
24 |
Correct |
26 ms |
12492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1308 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
2936 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
2920 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |