#include <bits/stdc++.h>
#include "Anthony.h"
#define pb push_back
#define pi pair <int, int>
#define fi first
#define se second
using namespace std;
vector <pi> adj[20005];
vector <int> ans;
queue <int> q;
bool visited[20005];
int curr = -1;
//110100110100
int f(int x){
if(x == 0 or x == 1 or x == 3) return 1;
else return 0;
}
void dfs(int x, int p, int c){
if((x == 0 and adj[x].size() >= 2) or adj[x].size() > 2){
curr = -1;
int col = (c ? 0 : 1);
for(pi i : adj[x]){
if(i.fi == p) continue;
ans[i.se] = col;
dfs(i.fi, x, col);
}
}
else{ //line
if(curr == -1){
if(c == 0) curr = 0;
else curr = 1;
}
for(pi i : adj[x]){
if(i.fi == p) continue;
ans[i.se] = f(curr);
curr = (curr + 1) % 6;
dfs(i.fi, x, f(curr));
}
}
}
std::vector <int> Mark(int n, int m, int a, int b, std::vector <int> u, std::vector <int> v){
for(int i = 0; i < m; i++) ans.pb(0);
for(int i = 0; i < m; i++) adj[u[i]].pb({v[i], i}), adj[v[i]].pb({u[i], i});
dfs(0, -1, 0);
return ans;
}
#include <bits/stdc++.h>
#include "Catherine.h"
#define pb push_back
#define pi pair <int, int>
#define fi first
#define se second
using namespace std;
string seq = "", s[6];
bool correct;
int cnt;
//110100110100
void Init(int a, int b){
s[0] = "11010";
s[1] = "10100";
s[2] = "01001";
s[3] = "10011";
s[4] = "00110";
s[5] = "01101";
}
int Move(std::vector <int> y){
//initial
if(cnt == 0){
if(y[0] + y[1] != 2) correct = 1;
else{
if(y[0] == 1 and y[1] == 1){
seq.pb('0'), seq.pb('1');
cnt++;
return 1;
}
else if(y[0] == 2){
seq.pb('0'), seq.pb('0');
cnt++;
return 0;
}
else{
seq.pb('1'), seq.pb('1');
cnt++;
return 1;
}
}
}
if(cnt <= 3 and !correct){
cnt++;
if(y[0] + y[1] == 1){
if(y[0] == 1){
seq.pb('0');
return 0;
}
else{
seq.pb('1');
return 1;
}
}
else{
if(y[0] + y[1] == 0){
correct = 1;
return -1;
}
else if(y[0] == 1){
correct = 1;
return 0;
}
else if(y[1] == 1){
correct = 1;
return 1;
}
else{
correct = 1;
return -1;
}
}
}
if(cnt > 3 and !correct){
for(int k = 0; k < 6; k++) if(seq == s[k]){
correct = 1;
return -1;
}
correct = 1;
}
//correct direction
if(y[0] + y[1] > 2){
if(y[0] == 1) return 0;
else return 1;
}
else if(y[0] == 1) return 0;
else if(y[1] == 1) return 1;
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:88:1: warning: control reaches end of non-void function [-Wreturn-type]
88 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
15420 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
15420 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
13164 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
13164 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1288 KB |
Output is correct |
2 |
Incorrect |
1 ms |
1020 KB |
Wrong Answer [5] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
11116 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
11232 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |