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 <bits/stdc++.h>
using namespace std;
const int NMAX = 2e4 + 5;
const int ROOT = 0;
vector < int > G[NMAX];
vector < int > ans;
int Level[NMAX];
bool Sel[NMAX];
queue < int > Q;
void Add_Edge (int x, int y)
{
G[x].push_back(y), G[y].push_back(x);
return;
}
void BFS (int Node)
{
Sel[Node] = 1, Level[Node] = 0;
Q.push(Node);
while(!Q.empty())
{
int Node = Q.front();
Q.pop();
for(auto it : G[Node])
if(!Sel[it])
{
Sel[it] = 1, Level[it] = 1 + Level[Node];
Q.push(it);
}
}
return;
}
vector < int > Mark (int N, int M, int A, int B, vector < int > U, vector < int > V)
{
for(int i = 0; i < M; ++i)
{
int X = U[i], Y = V[i];
Add_Edge(X, Y);
}
BFS(ROOT);
ans.resize(M);
ans.shrink_to_fit();
if(A >= 3)
A = 3;
for(int i = 0; i < M; ++i)
ans[i] = min(Level[U[i]], Level[V[i]]) % A;
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
int A, B, moves = 0, Last = 0;
void Init (int a, int b)
{
A = a, B = b;
return;
}
int Move (vector < int > y)
{
++moves;
int cnt = 0, X = -1;
for(int i = 0; i < A; ++i)
if(y[i])
++cnt, X = i;
if(cnt == 0)
return -1;
if(cnt == 1 || (A == 2 && moves == 1))
{
Last = X;
return X;
}
if(A == 2)
{
for(int i = 0; i < A; ++i)
if(y[i] && i != Last)
{
Last = i;
break;
}
return Last;
}
if(y[0] && y[1])
return 0;
if(y[1] && y[2])
return 1;
return 2;
}
# | 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... |