Submission #212383

# Submission time Handle Problem Language Result Execution time Memory
212383 2020-03-22T20:26:03 Z dolphingarlic Stray Cat (JOI20_stray) C++14
100 / 100
105 ms 16740 KB
#include "Anthony.h"
#include <bits/stdc++.h>
#define FOR(i,x,y) for(int i=x; i < y; i++)
using namespace std;namespace{vector<int> X,p={0,1,0,0,1,1};vector<pair<int,int>> g[20000];void T(int n=0,int r=-1,int d=0){if(~r)X[r]=p[d];for(pair<int,int> i:g[n])if(i.second != r){if(g[n].size()== 2)T(i.first,i.second,(d+1)% 6);else T(i.first,i.second,1 ^ p[d]);}}int v[20000];void G(){queue<int> q;q.push(0);v[0]=1;while(q.size()){int c=q.front();q.pop();for(pair<int,int> i:g[c])if(!v[i.first]){X[i.second]=(v[c]-1)% 3;v[i.first]=v[c]+1;q.push(i.first); } else X[i.second]=(v[i.first]-1)% 3;}}}vector<int> Mark(int N,int M,int A,int B,vector<int> U,vector<int> V){FOR(i,0,M){g[U[i]].push_back({V[i],i});g[V[i]].push_back({U[i],i});}X.resize(M);if(B)T();else G();return X;}
#include "Catherine.h"
#include <bits/stdc++.h>
#define FOR(i,x,y) for(int i=x; i < y; i++)
using namespace std;namespace {int A,B,l;bool o;vector<int> s;vector<vector<int>> O={{1,1,0,0,1},{1,0,0,1,0},{0,0,1,0,1},{0,1,0,1,1},{1,0,1,1,0},{0,1,1,0,0},};int T(vector<int> y){vector<int> Y=y;if(~l)Y[l]++;int deg=accumulate(Y.begin(),Y.end(),0);if(deg != 2)o=true;if(o){if(deg == 1){if(l == -1)FOR(i,0,A)if(y[i])return l=i;return -1;} else if(deg == 2){FOR(i,0,A)if(y[i])return l=i;} else {FOR(i,0,A)if(Y[i] == 1){if(!y[i])return -1;return l=i;}}} else {if(~l){FOR(i,0,A)if(y[i]){s.push_back(i);if(s.size()< 5)return l=i;else {o=true;for(vector<int> v : O)if(v == s)return l=i;return -1;}}} else {FOR(i,0,A)if(y[i]){s.push_back(i);y[i]--;FOR(j,0,A)if(y[j]){s.push_back(j);return l=j;}}}}}int G(vector<int> y){if(~l)y[l]++;FOR(i,0,3)if(y[i] && y[(i+1)% 3])return l=i;FOR(i,0,3)if(y[i])return l=i;}}void Init(int A,int B){::A=A;::B=B;o=false;l=-1;}int Move(vector<int> y){if(B)return T(y);return G(y);}

Compilation message

Catherine.cpp: In function 'int {anonymous}::T(std::vector<int>)':
Catherine.cpp:4:692: warning: control reaches end of non-void function [-Wreturn-type]
 using namespace std;namespace {int A,B,l;bool o;vector<int> s;vector<vector<int>> O={{1,1,0,0,1},{1,0,0,1,0},{0,0,1,0,1},{0,1,0,1,1},{1,0,1,1,0},{0,1,1,0,0},};int T(vector<int> y){vector<int> Y=y;if(~l)Y[l]++;int deg=accumulate(Y.begin(),Y.end(),0);if(deg != 2)o=true;if(o){if(deg == 1){if(l == -1)FOR(i,0,A)if(y[i])return l=i;return -1;} else if(deg == 2){FOR(i,0,A)if(y[i])return l=i;} else {FOR(i,0,A)if(Y[i] == 1){if(!y[i])return -1;return l=i;}}} else {if(~l){FOR(i,0,A)if(y[i]){s.push_back(i);if(s.size()< 5)return l=i;else {o=true;for(vector<int> v : O)if(v == s)return l=i;return -1;}}} else {FOR(i,0,A)if(y[i]){s.push_back(i);y[i]--;FOR(j,0,A)if(y[j]){s.push_back(j);return l=j;}}}}}int G(vector<int> y){if(~l)y[l]++;FOR(i,0,3)if(y[i] && y[(i+1)% 3])return l=i;FOR(i,0,3)if(y[i])return l=i;}}void Init(int A,int B){::A=A;::B=B;o=false;l=-1;}int Move(vector<int> y){if(B)return T(y);return G(y);}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^
Catherine.cpp: In function 'int {anonymous}::G(std::vector<int>)':
Catherine.cpp:4:800: warning: control reaches end of non-void function [-Wreturn-type]
 using namespace std;namespace {int A,B,l;bool o;vector<int> s;vector<vector<int>> O={{1,1,0,0,1},{1,0,0,1,0},{0,0,1,0,1},{0,1,0,1,1},{1,0,1,1,0},{0,1,1,0,0},};int T(vector<int> y){vector<int> Y=y;if(~l)Y[l]++;int deg=accumulate(Y.begin(),Y.end(),0);if(deg != 2)o=true;if(o){if(deg == 1){if(l == -1)FOR(i,0,A)if(y[i])return l=i;return -1;} else if(deg == 2){FOR(i,0,A)if(y[i])return l=i;} else {FOR(i,0,A)if(Y[i] == 1){if(!y[i])return -1;return l=i;}}} else {if(~l){FOR(i,0,A)if(y[i]){s.push_back(i);if(s.size()< 5)return l=i;else {o=true;for(vector<int> v : O)if(v == s)return l=i;return -1;}}} else {FOR(i,0,A)if(y[i]){s.push_back(i);y[i]--;FOR(j,0,A)if(y[j]){s.push_back(j);return l=j;}}}}}int G(vector<int> y){if(~l)y[l]++;FOR(i,0,3)if(y[i] && y[(i+1)% 3])return l=i;FOR(i,0,3)if(y[i])return l=i;}}void Init(int A,int B){::A=A;::B=B;o=false;l=-1;}int Move(vector<int> y){if(B)return T(y);return G(y);}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ^
# Verdict Execution time Memory Grader output
1 Correct 69 ms 15716 KB Output is correct
2 Correct 11 ms 1640 KB Output is correct
3 Correct 50 ms 14968 KB Output is correct
4 Correct 77 ms 16628 KB Output is correct
5 Correct 84 ms 16740 KB Output is correct
6 Correct 66 ms 15612 KB Output is correct
7 Correct 61 ms 15484 KB Output is correct
8 Correct 71 ms 16116 KB Output is correct
9 Correct 72 ms 16260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 15716 KB Output is correct
2 Correct 11 ms 1640 KB Output is correct
3 Correct 50 ms 14968 KB Output is correct
4 Correct 77 ms 16628 KB Output is correct
5 Correct 84 ms 16740 KB Output is correct
6 Correct 66 ms 15612 KB Output is correct
7 Correct 61 ms 15484 KB Output is correct
8 Correct 71 ms 16116 KB Output is correct
9 Correct 72 ms 16260 KB Output is correct
10 Correct 51 ms 13668 KB Output is correct
11 Correct 50 ms 13696 KB Output is correct
12 Correct 62 ms 13744 KB Output is correct
13 Correct 56 ms 13684 KB Output is correct
14 Correct 54 ms 13956 KB Output is correct
15 Correct 77 ms 14300 KB Output is correct
16 Correct 71 ms 16308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 13356 KB Output is correct
2 Correct 8 ms 1536 KB Output is correct
3 Correct 49 ms 12848 KB Output is correct
4 Correct 79 ms 14468 KB Output is correct
5 Correct 65 ms 14732 KB Output is correct
6 Correct 70 ms 13340 KB Output is correct
7 Correct 57 ms 13344 KB Output is correct
8 Correct 63 ms 13944 KB Output is correct
9 Correct 65 ms 14080 KB Output is correct
10 Correct 67 ms 13788 KB Output is correct
11 Correct 62 ms 13772 KB Output is correct
12 Correct 74 ms 13796 KB Output is correct
13 Correct 81 ms 13772 KB Output is correct
14 Correct 71 ms 14076 KB Output is correct
15 Correct 78 ms 14076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 13356 KB Output is correct
2 Correct 8 ms 1536 KB Output is correct
3 Correct 49 ms 12848 KB Output is correct
4 Correct 79 ms 14468 KB Output is correct
5 Correct 65 ms 14732 KB Output is correct
6 Correct 70 ms 13340 KB Output is correct
7 Correct 57 ms 13344 KB Output is correct
8 Correct 63 ms 13944 KB Output is correct
9 Correct 65 ms 14080 KB Output is correct
10 Correct 67 ms 13788 KB Output is correct
11 Correct 62 ms 13772 KB Output is correct
12 Correct 74 ms 13796 KB Output is correct
13 Correct 81 ms 13772 KB Output is correct
14 Correct 71 ms 14076 KB Output is correct
15 Correct 78 ms 14076 KB Output is correct
16 Correct 56 ms 11712 KB Output is correct
17 Correct 52 ms 11764 KB Output is correct
18 Correct 77 ms 11760 KB Output is correct
19 Correct 56 ms 12012 KB Output is correct
20 Correct 66 ms 12520 KB Output is correct
21 Correct 63 ms 12152 KB Output is correct
22 Correct 69 ms 13968 KB Output is correct
23 Correct 63 ms 11904 KB Output is correct
24 Correct 60 ms 11888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1792 KB Output is correct
2 Correct 10 ms 1536 KB Output is correct
3 Correct 10 ms 1792 KB Output is correct
4 Correct 11 ms 1792 KB Output is correct
5 Correct 11 ms 1792 KB Output is correct
6 Correct 10 ms 1792 KB Output is correct
7 Correct 11 ms 1856 KB Output is correct
8 Correct 13 ms 1792 KB Output is correct
9 Correct 12 ms 1792 KB Output is correct
10 Correct 10 ms 1792 KB Output is correct
11 Correct 10 ms 1792 KB Output is correct
12 Correct 10 ms 1792 KB Output is correct
13 Correct 11 ms 1536 KB Output is correct
14 Correct 10 ms 1792 KB Output is correct
15 Correct 11 ms 1792 KB Output is correct
16 Correct 10 ms 1792 KB Output is correct
17 Correct 11 ms 1792 KB Output is correct
18 Correct 11 ms 1536 KB Output is correct
19 Correct 11 ms 1536 KB Output is correct
20 Correct 11 ms 1792 KB Output is correct
21 Correct 10 ms 1548 KB Output is correct
22 Correct 11 ms 1792 KB Output is correct
23 Correct 10 ms 1792 KB Output is correct
24 Correct 11 ms 1536 KB Output is correct
25 Correct 10 ms 1536 KB Output is correct
26 Correct 12 ms 1536 KB Output is correct
27 Correct 10 ms 1548 KB Output is correct
28 Correct 11 ms 1548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 11588 KB Output is correct
2 Correct 73 ms 12416 KB Output is correct
3 Correct 10 ms 1536 KB Output is correct
4 Correct 54 ms 11180 KB Output is correct
5 Correct 79 ms 13648 KB Output is correct
6 Correct 75 ms 13668 KB Output is correct
7 Correct 64 ms 13044 KB Output is correct
8 Correct 61 ms 12976 KB Output is correct
9 Correct 68 ms 13684 KB Output is correct
10 Correct 93 ms 13688 KB Output is correct
11 Correct 83 ms 13820 KB Output is correct
12 Correct 82 ms 13952 KB Output is correct
13 Correct 73 ms 13688 KB Output is correct
14 Correct 70 ms 13840 KB Output is correct
15 Correct 69 ms 13796 KB Output is correct
16 Correct 82 ms 13820 KB Output is correct
17 Correct 74 ms 13696 KB Output is correct
18 Correct 65 ms 13428 KB Output is correct
19 Correct 64 ms 13516 KB Output is correct
20 Correct 61 ms 13428 KB Output is correct
21 Correct 67 ms 13388 KB Output is correct
22 Correct 71 ms 13428 KB Output is correct
23 Correct 53 ms 11500 KB Output is correct
24 Correct 63 ms 11344 KB Output is correct
25 Correct 54 ms 11900 KB Output is correct
26 Correct 57 ms 11772 KB Output is correct
27 Correct 68 ms 12580 KB Output is correct
28 Correct 69 ms 12752 KB Output is correct
29 Correct 72 ms 12780 KB Output is correct
30 Correct 79 ms 12700 KB Output is correct
31 Correct 59 ms 11484 KB Output is correct
32 Correct 61 ms 11648 KB Output is correct
33 Correct 72 ms 11724 KB Output is correct
34 Correct 64 ms 11636 KB Output is correct
35 Correct 68 ms 12580 KB Output is correct
36 Correct 64 ms 12532 KB Output is correct
37 Correct 75 ms 12536 KB Output is correct
38 Correct 57 ms 12412 KB Output is correct
39 Correct 55 ms 12404 KB Output is correct
40 Correct 68 ms 12476 KB Output is correct
41 Correct 95 ms 13052 KB Output is correct
42 Correct 105 ms 13048 KB Output is correct
43 Correct 104 ms 13100 KB Output is correct
44 Correct 94 ms 13044 KB Output is correct
45 Correct 92 ms 13044 KB Output is correct
46 Correct 75 ms 13052 KB Output is correct
47 Correct 68 ms 12292 KB Output is correct
48 Correct 77 ms 12276 KB Output is correct
49 Correct 55 ms 12284 KB Output is correct
50 Correct 57 ms 12292 KB Output is correct
51 Correct 60 ms 11516 KB Output is correct
52 Correct 69 ms 11644 KB Output is correct
53 Correct 64 ms 11604 KB Output is correct
54 Correct 56 ms 11516 KB Output is correct
55 Correct 56 ms 11636 KB Output is correct
56 Correct 79 ms 11604 KB Output is correct
57 Correct 55 ms 11516 KB Output is correct
58 Correct 53 ms 11584 KB Output is correct
59 Correct 53 ms 11720 KB Output is correct
60 Correct 55 ms 11724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 11492 KB Output is correct
2 Correct 64 ms 12352 KB Output is correct
3 Correct 10 ms 1536 KB Output is correct
4 Correct 44 ms 11128 KB Output is correct
5 Correct 69 ms 13664 KB Output is correct
6 Correct 78 ms 13796 KB Output is correct
7 Correct 57 ms 12916 KB Output is correct
8 Correct 56 ms 13060 KB Output is correct
9 Correct 75 ms 13800 KB Output is correct
10 Correct 80 ms 13796 KB Output is correct
11 Correct 86 ms 13888 KB Output is correct
12 Correct 81 ms 13872 KB Output is correct
13 Correct 72 ms 13780 KB Output is correct
14 Correct 86 ms 13860 KB Output is correct
15 Correct 75 ms 13820 KB Output is correct
16 Correct 83 ms 13724 KB Output is correct
17 Correct 77 ms 13564 KB Output is correct
18 Correct 76 ms 13300 KB Output is correct
19 Correct 75 ms 13428 KB Output is correct
20 Correct 73 ms 13432 KB Output is correct
21 Correct 93 ms 13436 KB Output is correct
22 Correct 76 ms 13564 KB Output is correct
23 Correct 59 ms 11472 KB Output is correct
24 Correct 53 ms 11508 KB Output is correct
25 Correct 64 ms 11884 KB Output is correct
26 Correct 71 ms 11876 KB Output is correct
27 Correct 65 ms 12516 KB Output is correct
28 Correct 63 ms 12676 KB Output is correct
29 Correct 67 ms 12532 KB Output is correct
30 Correct 68 ms 12692 KB Output is correct
31 Correct 64 ms 11436 KB Output is correct
32 Correct 59 ms 11512 KB Output is correct
33 Correct 55 ms 11764 KB Output is correct
34 Correct 54 ms 11788 KB Output is correct
35 Correct 66 ms 12516 KB Output is correct
36 Correct 68 ms 12564 KB Output is correct
37 Correct 68 ms 12532 KB Output is correct
38 Correct 67 ms 12524 KB Output is correct
39 Correct 62 ms 12596 KB Output is correct
40 Correct 64 ms 12516 KB Output is correct
41 Correct 72 ms 13036 KB Output is correct
42 Correct 74 ms 13088 KB Output is correct
43 Correct 69 ms 13052 KB Output is correct
44 Correct 68 ms 13172 KB Output is correct
45 Correct 67 ms 13028 KB Output is correct
46 Correct 65 ms 13168 KB Output is correct
47 Correct 62 ms 12268 KB Output is correct
48 Correct 60 ms 12408 KB Output is correct
49 Correct 56 ms 12276 KB Output is correct
50 Correct 55 ms 12364 KB Output is correct
51 Correct 58 ms 11644 KB Output is correct
52 Correct 56 ms 11644 KB Output is correct
53 Correct 54 ms 11612 KB Output is correct
54 Correct 55 ms 11696 KB Output is correct
55 Correct 59 ms 11620 KB Output is correct
56 Correct 52 ms 11636 KB Output is correct
57 Correct 52 ms 11672 KB Output is correct
58 Correct 59 ms 11644 KB Output is correct
59 Correct 54 ms 11768 KB Output is correct
60 Correct 58 ms 11644 KB Output is correct