#include "Anthony.h"
#include <vector>
#include<bits/stdc++.h>
namespace {
using namespace std;
#define f first
#define s second
int A,B;
const int mxn=2e4+5;
vector<pair<int,int>> adj[mxn];
vector<int> ans;
bool visited[mxn];
int depth[mxn];
int par[mxn];
void dfs(int v,int p=-1,int c=0){
visited[v]=true;
for(auto u:adj[v]){
if(visited[u.f]){
continue;
}
ans[u.s]=c^1;
depth[u.f]=depth[v]+1;
dfs(u.f,v,ans[u.s]);
}
}
void bfs(){
queue<pair<int,int>> q;
q.push({0,0});
visited[0]=true;
while(!q.empty()){
int v=q.front().f;
int c=q.front().s;
q.pop();
for(auto u:adj[v]){
if(visited[u.f]){
if(u.f!=par[v]){
if(depth[v]==depth[u.f]){
ans[u.s]=(c+1)%3;
}
else if(depth[v]<depth[u.f]){
ans[u.s]=(c+1)%3;
}
}
continue;
}
visited[u.f]=true;
ans[u.s]=(c+1)%3;
depth[u.f]=depth[v]+1;
q.push({u.f,ans[u.s]});
}
}
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,std::vector<int> U, std::vector<int> V) {
::A = A;
::B = B;
ans.resize(M);
for(int i=0;i<M;i++){
adj[U[i]].push_back({V[i],i});
adj[V[i]].push_back({U[i],i});
}
dfs(0);
return ans;
}
#include "Catherine.h"
#include <vector>
#include<bits/stdc++.h>
namespace {
using namespace std;
int A, B;
int variable_example = 0;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(std::vector<int> y) {
mt19937 rng(time(NULL));
vector<int> pos;
for(int i=0;i<(int)y.size();i++){
if(y[i]>1) pos.push_back(i);
}
if((int)pos.size()==1) return pos[0]^1;
vector<int> pos2;
for(int i=0;i<(int)y.size();i++){
if(y[i]==1) pos2.push_back(i);
}
if((int)pos2.size()==1) return pos2[0];
return std::uniform_int_distribution<int>(0, 1)(rng);
}
Compilation message
Anthony.cpp:30:6: warning: 'void {anonymous}::bfs()' defined but not used [-Wunused-function]
30 | void bfs(){
| ^~~
Catherine.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
7 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
16244 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
16244 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
14164 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
14164 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1560 KB |
Output is correct |
2 |
Correct |
1 ms |
1296 KB |
Output is correct |
3 |
Correct |
2 ms |
1564 KB |
Output is correct |
4 |
Correct |
3 ms |
1560 KB |
Output is correct |
5 |
Correct |
3 ms |
1560 KB |
Output is correct |
6 |
Correct |
3 ms |
1572 KB |
Output is correct |
7 |
Incorrect |
2 ms |
1564 KB |
Wrong Answer [5] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
11864 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
11892 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |