#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int,int>>> graph;
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V){
graph.resize(N);
for(int i = 0 ; i < M ; i += 1){
graph[U[i]].push_back({V[i],i});
graph[V[i]].push_back({U[i],i});
}
vector<int> vals = {1,0,0,1,1,0};
bool seen[N];
memset(seen,false,sizeof seen);
vector<int> ans(M,0);
queue<pair<int,int>> q;
q.push({0,0});
seen[0] = true;
int dist = 0 , cnt = 0 , s = 0;
while(q.size()){
int f = q.size();
//assert(f > 0);
while(f--){
pair<int,int> curr = q.front();
q.pop();
int cnt2 = 0;
//assert(curr.first < N);
for(pair<int,int> i : graph[curr.first]){
//assert(i.first < N);
//assert(i.second < M);
if(!seen[i.first]){
cnt2 += 1;
}
}
if(cnt2 > 1 && curr.first != 0){
//assert(curr.first < N);
for(pair<int,int> i : graph[curr.first]){
//assert(i.first < N);
//assert(i.second < M);
if(!seen[i.first]){
ans[i.second] = 1-ans[curr.second];
q.push(i);
seen[i.first] = true;
}
}
}else if(cnt2 == 1){
//assert(curr.first < N);
for(pair<int,int> i : graph[curr.first]){
//assert(i.first < N);
//assert(i.second < M);
if(!seen[i.first]){
ans[i.second] = dist;
q.push(i);
seen[i.first] = true;
}
}
}
}
assert(cnt < 6);//
dist = vals[cnt];
cnt = (cnt+1)%6;
}
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
int A,B,cnt=0,last=-1;
vector<int> vals;
void Init(int a, int b) {
A = a;
B = b;
}
void shift(){
vector<int> vv;
for(int i = 1 ; i < 6 ; i += 1){
vv.push_back(vals[i]);
}
vv.push_back(vals[0]);
vals = vv;
}
bool ok(){
vector<int> vv = {1,0,0,1,1,0};
for(int i = 0 ; i < 6 ; i += 1){
shift();
if(vals == vv){
vals.clear();
return true;
}
}
vals.clear();
return false;
}
int Move(vector<int> y){
if(cnt < 6){
if(cnt == 0 && y[0]+y[1] > 2){
cnt = 6;
if(y[0] == 1){
return last = 0;
}
return last = 1;
}else if(cnt > 0 && y[0]+y[1] > 1){
cnt = 6;
if(y[1-last] == 1){
return last = 1-last;
}
return -1;
}
if(cnt == 0){
cnt += 1;
if(y[0]){
vals.push_back(0);
return last = 0;
}
vals.push_back(1);
return last = 1;
}
if(y[0] == 1){
cnt += 1;
vals.push_back(0);
return last = 0;
}else if(y[1] == 1){
cnt += 1;
vals.push_back(1);
return last = 1;
}else{
cnt = 6;
return -1;
}
}
if(y[0]+y[1] > 1){
return last = 1-last;
}
if(vals.size() == 6){
if(ok()){
return -1;
}
}
if(y[0]+y[1] == 1){
if(y[0] == 1){
return last = 0;
}
return last = 1;
}
}
Compilation message
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:19:27: warning: unused variable 's' [-Wunused-variable]
int dist = 0 , cnt = 0 , s = 0;
^
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:85:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
52 ms |
14544 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
52 ms |
14544 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
87 ms |
13000 KB |
Output is correct |
2 |
Correct |
10 ms |
784 KB |
Output is correct |
3 |
Incorrect |
46 ms |
12676 KB |
Wrong Answer [5] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
87 ms |
13000 KB |
Output is correct |
2 |
Correct |
10 ms |
784 KB |
Output is correct |
3 |
Incorrect |
46 ms |
12676 KB |
Wrong Answer [5] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
1036 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
10876 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
48 ms |
10884 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |