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;
vector<int>adj[200001];
int depth[200001],col[200001];
void dfs(int x, int p){
depth[x] = depth[p] + 1;
for(auto s: adj[x]){
if(!depth[s]) dfs(s,x);
}
}
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
for(int i = 1; i <= N; i++) adj[i].clear();
for(int i = 0; i < M; i++){
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
dfs(0,0);
vector<int>ans;
for(int i = 0; i < M; i++){
ans.push_back(max(depth[U[i]], depth[V[i]]) % 3);
}
return ans;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
int a,b;
void Init(int A, int B) {
a = A;
b = B;
}
int Move(vector<int> y) {
set<int>p;
int col = 0;
for(auto s: y) {
if(s > 0){
p.insert(col);
}
col++;
}
auto xx = *p.begin(), yy = 0;
p.erase(p.begin());
if(p.empty()) return xx;
if(xx == 0 and *p.begin() == 1) return 0;
if(xx == 1 and *p.begin() == 2) return 1;
if(xx == 0 and *p.begin() == 2) return 2;
return -1;
}
Compilation message (stderr)
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:22:25: warning: unused variable 'yy' [-Wunused-variable]
22 | auto xx = *p.begin(), yy = 0;
| ^~
# | 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... |