This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
39 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |