#include "Anthony.h"
#include <bits/stdc++.h>
typedef int ll;
using namespace std;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
namespace{}
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
vector<ll> pat = {1,0,1,1,0,0};
vector<vector<int>> edges[N];
FOR(i,0,M){
edges[U[i]].push_back({V[i],i});
edges[V[i]].push_back({U[i],i});
}
bool visited[N];
FOR(i,0,N) visited[i] = false;
vector<int> x(N);
vector<int> ans(M);
FOR(i,0,N) x[i] = 0;
queue<vector<int>> q;
visited[0] = true;
q.push({0,0});
while (q.size()){
vector<int> node = q.front();
q.pop();
for (auto&i : edges[node[0]]){
if (edges[node[0]].size() == 2){
if (!visited[i[0]]){
visited[i[0]] = true;
ans[i[1]] = pat[node[1]%6];
q.push({i[0], node[1]+1});
}
}else{
if (!visited[i[0]]){
visited[i[0]] = true;
ll cur = -1;
if (pat[(node[1]-1+6)%6]==0){
cur = 0;
}else{
cur = 5;
}
ans[i[1]] = pat[cur%6];
q.push({i[0], cur+1});
}
}
}
}
// for (auto&i : ans){
// cout << i << endl;
// }
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
typedef int ll;
using namespace std;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
namespace {
int A, B;
ll choice,moved,last;
bool up,init;
vector<ll> stuff;
set<vector<ll>> down;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
choice = 0;
moved = 0;
last = 0;
up = false;
init = false;
down = {
{1,0,1,1,0,0},
{0,1,1,0,0,1},
{1,1,0,0,1,0},
{1,0,0,1,0,1},
{0,0,1,0,1,1},
{0,1,0,1,1,0}
};
}
int Move(std::vector<int> y) {
//cout << y[0] << " " << y[1] << " " << up << endl;
if (!init){
init = true;
if (y[0]+y[1] == 2){
if (y[0]>0){
last = 0;stuff.push_back(0);
return 0;
} else{
last = 1;stuff.push_back(1);
return 1;
}
}else{
up = true;
if (y[0]==1){
last = 0;
return 0;
}else{
last = 1;
return 1;
}
}
}
if (!up){
if (stuff.size()==6){
if (down.count(stuff)){
up = true;
return -1;
}
else{
up = true;
}
}
else{
if (y[0]+y[1]==1){
if (y[0]){
last = 0;stuff.push_back(0);return 0;
}
else{
last = 1;stuff.push_back(1);return 1;
}
}
else{
up = true;
if (y[1-last]==1){
last = 1-last;
return last;
}else{
return -1;
}
}
}
}
if (up){
if (y[0]==1 && y[1]==0){
last = 0; return 0;
}
if (y[0]==0 && y[1]==1){
last = 1; return 1;
}
last = 1-last;
return last;
}
// if (!y[0] && y[1] && y[2]){
// return 1;
// }
// if (y[0] && !y[1] && y[2]){
// return 2;
// }
// if (y[0] && y[1] && !y[2]){
// return 0;
// }
// if (y[0] && !y[1] && !y[2]){
// return 0;
// }
// if (!y[0] && y[1] && !y[2]){
// return 1;
// }
// if (!y[0] && !y[1] && y[2]){
// return 2;
// }
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:147:1: warning: control reaches end of non-void function [-Wreturn-type]
147 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
17140 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
17140 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
14752 KB |
Output is correct |
2 |
Correct |
0 ms |
516 KB |
Output is correct |
3 |
Correct |
36 ms |
14448 KB |
Output is correct |
4 |
Correct |
49 ms |
15644 KB |
Output is correct |
5 |
Correct |
53 ms |
15648 KB |
Output is correct |
6 |
Correct |
39 ms |
14852 KB |
Output is correct |
7 |
Incorrect |
37 ms |
14724 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
14752 KB |
Output is correct |
2 |
Correct |
0 ms |
516 KB |
Output is correct |
3 |
Correct |
36 ms |
14448 KB |
Output is correct |
4 |
Correct |
49 ms |
15644 KB |
Output is correct |
5 |
Correct |
53 ms |
15648 KB |
Output is correct |
6 |
Correct |
39 ms |
14852 KB |
Output is correct |
7 |
Incorrect |
37 ms |
14724 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
896 KB |
Output is correct |
2 |
Correct |
0 ms |
636 KB |
Output is correct |
3 |
Correct |
2 ms |
904 KB |
Output is correct |
4 |
Correct |
2 ms |
904 KB |
Output is correct |
5 |
Correct |
2 ms |
896 KB |
Output is correct |
6 |
Correct |
2 ms |
896 KB |
Output is correct |
7 |
Correct |
2 ms |
896 KB |
Output is correct |
8 |
Correct |
2 ms |
896 KB |
Output is correct |
9 |
Correct |
2 ms |
896 KB |
Output is correct |
10 |
Correct |
2 ms |
896 KB |
Output is correct |
11 |
Correct |
2 ms |
904 KB |
Output is correct |
12 |
Correct |
2 ms |
900 KB |
Output is correct |
13 |
Correct |
2 ms |
896 KB |
Output is correct |
14 |
Correct |
2 ms |
904 KB |
Output is correct |
15 |
Correct |
2 ms |
896 KB |
Output is correct |
16 |
Correct |
2 ms |
896 KB |
Output is correct |
17 |
Correct |
2 ms |
904 KB |
Output is correct |
18 |
Correct |
2 ms |
908 KB |
Output is correct |
19 |
Correct |
2 ms |
900 KB |
Output is correct |
20 |
Correct |
2 ms |
896 KB |
Output is correct |
21 |
Correct |
2 ms |
896 KB |
Output is correct |
22 |
Correct |
3 ms |
904 KB |
Output is correct |
23 |
Correct |
2 ms |
904 KB |
Output is correct |
24 |
Correct |
2 ms |
904 KB |
Output is correct |
25 |
Correct |
2 ms |
896 KB |
Output is correct |
26 |
Correct |
2 ms |
896 KB |
Output is correct |
27 |
Correct |
2 ms |
896 KB |
Output is correct |
28 |
Correct |
2 ms |
896 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
13096 KB |
Output is correct |
2 |
Correct |
46 ms |
13456 KB |
Output is correct |
3 |
Correct |
0 ms |
600 KB |
Output is correct |
4 |
Correct |
33 ms |
13688 KB |
Output is correct |
5 |
Correct |
50 ms |
14544 KB |
Output is correct |
6 |
Correct |
50 ms |
14528 KB |
Output is correct |
7 |
Correct |
39 ms |
13612 KB |
Output is correct |
8 |
Correct |
40 ms |
13688 KB |
Output is correct |
9 |
Correct |
48 ms |
14560 KB |
Output is correct |
10 |
Correct |
47 ms |
14572 KB |
Output is correct |
11 |
Correct |
43 ms |
14564 KB |
Output is correct |
12 |
Correct |
47 ms |
14700 KB |
Output is correct |
13 |
Correct |
51 ms |
14556 KB |
Output is correct |
14 |
Correct |
50 ms |
14548 KB |
Output is correct |
15 |
Correct |
46 ms |
14560 KB |
Output is correct |
16 |
Correct |
47 ms |
14580 KB |
Output is correct |
17 |
Correct |
45 ms |
14284 KB |
Output is correct |
18 |
Correct |
41 ms |
14264 KB |
Output is correct |
19 |
Correct |
45 ms |
14312 KB |
Output is correct |
20 |
Correct |
43 ms |
14348 KB |
Output is correct |
21 |
Correct |
43 ms |
14392 KB |
Output is correct |
22 |
Correct |
49 ms |
14280 KB |
Output is correct |
23 |
Correct |
38 ms |
13496 KB |
Output is correct |
24 |
Correct |
41 ms |
13428 KB |
Output is correct |
25 |
Correct |
37 ms |
13676 KB |
Output is correct |
26 |
Correct |
39 ms |
13536 KB |
Output is correct |
27 |
Correct |
41 ms |
14148 KB |
Output is correct |
28 |
Correct |
44 ms |
14020 KB |
Output is correct |
29 |
Correct |
45 ms |
14160 KB |
Output is correct |
30 |
Correct |
41 ms |
13988 KB |
Output is correct |
31 |
Correct |
40 ms |
13564 KB |
Output is correct |
32 |
Correct |
36 ms |
13604 KB |
Output is correct |
33 |
Correct |
37 ms |
13620 KB |
Output is correct |
34 |
Correct |
39 ms |
13512 KB |
Output is correct |
35 |
Correct |
47 ms |
13940 KB |
Output is correct |
36 |
Correct |
42 ms |
13944 KB |
Output is correct |
37 |
Correct |
44 ms |
14040 KB |
Output is correct |
38 |
Correct |
42 ms |
14076 KB |
Output is correct |
39 |
Correct |
44 ms |
13896 KB |
Output is correct |
40 |
Correct |
45 ms |
13940 KB |
Output is correct |
41 |
Correct |
46 ms |
14228 KB |
Output is correct |
42 |
Correct |
46 ms |
14216 KB |
Output is correct |
43 |
Correct |
44 ms |
14228 KB |
Output is correct |
44 |
Correct |
43 ms |
14316 KB |
Output is correct |
45 |
Correct |
46 ms |
14288 KB |
Output is correct |
46 |
Correct |
48 ms |
14332 KB |
Output is correct |
47 |
Correct |
40 ms |
13800 KB |
Output is correct |
48 |
Correct |
41 ms |
13792 KB |
Output is correct |
49 |
Correct |
43 ms |
13744 KB |
Output is correct |
50 |
Correct |
50 ms |
13928 KB |
Output is correct |
51 |
Correct |
48 ms |
13776 KB |
Output is correct |
52 |
Correct |
50 ms |
13748 KB |
Output is correct |
53 |
Correct |
46 ms |
13704 KB |
Output is correct |
54 |
Correct |
45 ms |
13828 KB |
Output is correct |
55 |
Correct |
43 ms |
13788 KB |
Output is correct |
56 |
Correct |
46 ms |
13768 KB |
Output is correct |
57 |
Correct |
51 ms |
13772 KB |
Output is correct |
58 |
Correct |
46 ms |
13784 KB |
Output is correct |
59 |
Correct |
49 ms |
13608 KB |
Output is correct |
60 |
Correct |
48 ms |
13568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
13016 KB |
Output is correct |
2 |
Correct |
40 ms |
13488 KB |
Output is correct |
3 |
Correct |
0 ms |
516 KB |
Output is correct |
4 |
Correct |
33 ms |
13300 KB |
Output is correct |
5 |
Correct |
48 ms |
14232 KB |
Output is correct |
6 |
Correct |
48 ms |
14116 KB |
Output is correct |
7 |
Correct |
39 ms |
13260 KB |
Output is correct |
8 |
Correct |
38 ms |
13240 KB |
Output is correct |
9 |
Correct |
44 ms |
14132 KB |
Output is correct |
10 |
Correct |
45 ms |
14068 KB |
Output is correct |
11 |
Correct |
43 ms |
14176 KB |
Output is correct |
12 |
Correct |
47 ms |
14168 KB |
Output is correct |
13 |
Correct |
48 ms |
14160 KB |
Output is correct |
14 |
Correct |
44 ms |
14124 KB |
Output is correct |
15 |
Incorrect |
41 ms |
14064 KB |
Wrong Answer [6] |
16 |
Halted |
0 ms |
0 KB |
- |