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 <bits/stdc++.h>
#include "Anthony.h"
#define pb push_back
#define eb emplace_back
using namespace std;
int n,m;
vector<vector<pair<int,int>>> g;
vector<int> Mark1();
vector<int> Mark2();
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V){
n=N, m=M;
g.resize(n);
for(int i=0;i<m;i++){
g[U[i]].eb(V[i],i);
g[V[i]].eb(U[i],i);
}
if(A>=3) return Mark1();
return Mark2();
}
vector<int> Mark1(){
vector<int> dpth(n);
vector<bool> vis(n);
vector<int> ans(m);
queue<int> bfs;
bfs.push(0);
dpth[0]=0;
vis[0]=1;
while(!bfs.empty()){
int u=bfs.front();
bfs.pop();
for(auto p:g[u]){
int v=p.first, e=p.second;
if(!vis[v]){
vis[v]=1;
bfs.push(v);
dpth[v]=dpth[u]+1;
ans[e]=dpth[v]%3;
}
else{
if(dpth[v]==dpth[u]) ans[e]=(dpth[v]+1)%3;
else ans[e]=max(dpth[v],dpth[u])%3;
}
}
}
return ans;
}
vector<int> Mark2(){
vector<int> ans(m);
return ans;
}
#include <bits/stdc++.h>
#include "Catherine.h"
#define pb push_back
#define x first
#define y second
using namespace std;
int a;
void Init(int A, int B){
a=A;
}
int Move1(vector<int> arr);
int Move2(vector<int> arr);
int Move(vector<int> arr){
if(a>=3) return Move1(arr);
return Move2(arr);
}
int Move1(vector<int> arr){
set<int> st={0,1,2};
for(int i=0;i<3;i++) if(arr[i]==0) st.erase(i);
if(st.size()==1) return *st.begin();
if(*next(st.begin())-*st.begin()==1) return *st.begin();
return 2;
}
int Move2(vector<int> arr){
return -1;
}
# | 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... |