# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1063440 |
2024-08-17T18:33:37 Z |
Andrey |
Stray Cat (JOI20_stray) |
C++14 |
|
49 ms |
22120 KB |
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> haha[200001];
vector<int> dp(200001);
vector<int> troll(0);
int bruhseq[6] = {0,1,0,0,1,1};
void dfs(int a, int t, int d) {
int br = 0,x = -1;
for(pair<int,int> v: haha[a]) {
if(v.first != t) {
dfs(v.first,a,d+1);
br++;
x = dp[v.first];
}
}
if(br == 1) {
dp[a] = x+1;
for(auto v: haha[a]) {
if(v.first != t) {
if(x == -1) {
troll[v.second] = d%2;
}
else {
troll[v.second] = bruhseq[x%6];
}
}
}
}
else {
dp[a] = -1;
for(pair<int,int> v: haha[a]) {
if(v.first != t) {
troll[v.second] = d%2;
}
}
}
}
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++) {
haha[u[i]].push_back({v[i],i});
haha[v[i]].push_back({u[i],i});
}
if(a > 2) {
vector<int> br(n,INT_MAX);
br[0] = 0;
queue<int> idk;
idk.push(0);
vector<int> ans(m,-1);
while(!idk.empty()) {
int u = idk.front();
idk.pop();
for(pair<int,int> v: haha[u]) {
if(br[v.first] == INT_MAX) {
br[v.first] = br[u]+1;
idk.push(v.first);
}
}
}
for(int i = 0; i < m; i++) {
if(ans[i] == -1) {
int c = min(br[u[i]],br[v[i]])%3;
ans[i] = c;
}
}
return ans;
}
else {
troll.resize(n-1);
dfs(0,-1,1);
return troll;
}
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
int A;
int seq[6] = {0,1,0,0,1,1};
vector<int> wow(0);
bool first = true;
bool yeah = true;
void Init(int a, int b) {
A = a;
}
int Move(vector<int> haha) {
if(A > 2) {
vector<int> wow(0);
for(int i = 0; i < haha.size(); i++) {
if(haha[i] >= 1) {
wow.push_back(i);
}
}
if(wow.size() == 1) {
return wow[0];
}
else if(wow.size() == 2) {
if(wow[0] == 0 && wow[1] == 1) {
return 0;
}
else if(wow[0] == 1 && wow[1] == 2) {
return 1;
}
else {
return 2;
}
}
}
else {
if(first) {
first = false;
if(haha[0]+haha[1] == 2) {
if(haha[0] > 0) {
wow.push_back(0);
return 0;
}
else {
wow.push_back(1);
return 1;
}
}
else {
yeah = false;
if(haha[0] == 1) {
wow.push_back(0);
return 0;
}
else {
wow.push_back(1);
return 1;
}
}
}
else {
if(yeah) {
if(haha[0]+haha[1] == 0) {
yeah = false;
return -1;
}
else if(haha[0]+haha[1] > 1) {
yeah = false;
if(haha[0] == 0 || haha[1] == 0) {
return -1;
}
else {
if(wow[wow.size()-1] == 1) {
wow.push_back(0);
return 0;
}
else {
wow.push_back(1);
return 1;
}
}
}
else if(wow.size() == 6) {
for(int i = 0; i < 6; i++) {
bool bubu = true;
for(int j = i; j < i+6; j++) {
if(seq[j-i] != wow[j%6]) {
bubu = false;
}
}
if(bubu) {
yeah = false;
break;
}
}
if(yeah) {
yeah = false;
return -1;
}
else {
if(haha[0] > 0) {
wow.push_back(0);
return 0;
}
else {
wow.push_back(1);
return 1;
}
}
}
else {
if(haha[0] > 0) {
wow.push_back(0);
return 0;
}
else {
wow.push_back(1);
return 1;
}
}
}
else {
if(haha[0]+haha[1] == 0) {
return 1/0;
}
if(haha[1] > 0 && (haha[0] == 0 || wow[wow.size()-1] == 0)) {
wow.push_back(1);
return 1;
}
else {
wow.push_back(0);
return 0;
}
}
}
}
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:18:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
18 | for(int i = 0; i < haha.size(); i++) {
| ~~^~~~~~~~~~~~~
Catherine.cpp:126:29: warning: division by zero [-Wdiv-by-zero]
126 | return 1/0;
| ~^~
Catherine.cpp:139:1: warning: control reaches end of non-void function [-Wreturn-type]
139 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
20992 KB |
Output is correct |
2 |
Correct |
2 ms |
6196 KB |
Output is correct |
3 |
Correct |
27 ms |
20536 KB |
Output is correct |
4 |
Correct |
32 ms |
22120 KB |
Output is correct |
5 |
Correct |
37 ms |
22120 KB |
Output is correct |
6 |
Correct |
31 ms |
20892 KB |
Output is correct |
7 |
Correct |
27 ms |
20888 KB |
Output is correct |
8 |
Correct |
39 ms |
21524 KB |
Output is correct |
9 |
Correct |
31 ms |
21556 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
20992 KB |
Output is correct |
2 |
Correct |
2 ms |
6196 KB |
Output is correct |
3 |
Correct |
27 ms |
20536 KB |
Output is correct |
4 |
Correct |
32 ms |
22120 KB |
Output is correct |
5 |
Correct |
37 ms |
22120 KB |
Output is correct |
6 |
Correct |
31 ms |
20892 KB |
Output is correct |
7 |
Correct |
27 ms |
20888 KB |
Output is correct |
8 |
Correct |
39 ms |
21524 KB |
Output is correct |
9 |
Correct |
31 ms |
21556 KB |
Output is correct |
10 |
Correct |
37 ms |
19028 KB |
Output is correct |
11 |
Correct |
23 ms |
19040 KB |
Output is correct |
12 |
Correct |
32 ms |
18952 KB |
Output is correct |
13 |
Correct |
26 ms |
18948 KB |
Output is correct |
14 |
Correct |
35 ms |
19288 KB |
Output is correct |
15 |
Correct |
28 ms |
19644 KB |
Output is correct |
16 |
Correct |
41 ms |
21600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
18596 KB |
Output is correct |
2 |
Correct |
2 ms |
6196 KB |
Output is correct |
3 |
Correct |
22 ms |
18216 KB |
Output is correct |
4 |
Correct |
33 ms |
19800 KB |
Output is correct |
5 |
Correct |
49 ms |
19772 KB |
Output is correct |
6 |
Correct |
25 ms |
18536 KB |
Output is correct |
7 |
Correct |
25 ms |
18472 KB |
Output is correct |
8 |
Correct |
28 ms |
19400 KB |
Output is correct |
9 |
Correct |
32 ms |
19336 KB |
Output is correct |
10 |
Correct |
27 ms |
19056 KB |
Output is correct |
11 |
Correct |
28 ms |
19048 KB |
Output is correct |
12 |
Correct |
37 ms |
19052 KB |
Output is correct |
13 |
Correct |
28 ms |
18904 KB |
Output is correct |
14 |
Correct |
32 ms |
19228 KB |
Output is correct |
15 |
Correct |
30 ms |
19268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
18596 KB |
Output is correct |
2 |
Correct |
2 ms |
6196 KB |
Output is correct |
3 |
Correct |
22 ms |
18216 KB |
Output is correct |
4 |
Correct |
33 ms |
19800 KB |
Output is correct |
5 |
Correct |
49 ms |
19772 KB |
Output is correct |
6 |
Correct |
25 ms |
18536 KB |
Output is correct |
7 |
Correct |
25 ms |
18472 KB |
Output is correct |
8 |
Correct |
28 ms |
19400 KB |
Output is correct |
9 |
Correct |
32 ms |
19336 KB |
Output is correct |
10 |
Correct |
27 ms |
19056 KB |
Output is correct |
11 |
Correct |
28 ms |
19048 KB |
Output is correct |
12 |
Correct |
37 ms |
19052 KB |
Output is correct |
13 |
Correct |
28 ms |
18904 KB |
Output is correct |
14 |
Correct |
32 ms |
19228 KB |
Output is correct |
15 |
Correct |
30 ms |
19268 KB |
Output is correct |
16 |
Correct |
30 ms |
16948 KB |
Output is correct |
17 |
Correct |
22 ms |
16988 KB |
Output is correct |
18 |
Correct |
24 ms |
16956 KB |
Output is correct |
19 |
Correct |
26 ms |
17056 KB |
Output is correct |
20 |
Correct |
33 ms |
17636 KB |
Output is correct |
21 |
Correct |
25 ms |
17504 KB |
Output is correct |
22 |
Correct |
33 ms |
19396 KB |
Output is correct |
23 |
Correct |
26 ms |
17064 KB |
Output is correct |
24 |
Correct |
39 ms |
17156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
6712 KB |
Output is correct |
2 |
Correct |
2 ms |
6196 KB |
Output is correct |
3 |
Correct |
2 ms |
6448 KB |
Output is correct |
4 |
Correct |
3 ms |
6712 KB |
Output is correct |
5 |
Correct |
3 ms |
6712 KB |
Output is correct |
6 |
Correct |
4 ms |
6712 KB |
Output is correct |
7 |
Correct |
4 ms |
6704 KB |
Output is correct |
8 |
Correct |
4 ms |
6712 KB |
Output is correct |
9 |
Correct |
5 ms |
6700 KB |
Output is correct |
10 |
Correct |
3 ms |
6712 KB |
Output is correct |
11 |
Correct |
3 ms |
6712 KB |
Output is correct |
12 |
Correct |
4 ms |
6708 KB |
Output is correct |
13 |
Correct |
4 ms |
6704 KB |
Output is correct |
14 |
Correct |
5 ms |
6668 KB |
Output is correct |
15 |
Correct |
3 ms |
6704 KB |
Output is correct |
16 |
Correct |
4 ms |
6700 KB |
Output is correct |
17 |
Correct |
5 ms |
6456 KB |
Output is correct |
18 |
Correct |
4 ms |
6548 KB |
Output is correct |
19 |
Correct |
4 ms |
6448 KB |
Output is correct |
20 |
Correct |
4 ms |
6700 KB |
Output is correct |
21 |
Correct |
3 ms |
6656 KB |
Output is correct |
22 |
Correct |
2 ms |
6716 KB |
Output is correct |
23 |
Correct |
4 ms |
6664 KB |
Output is correct |
24 |
Correct |
3 ms |
6708 KB |
Output is correct |
25 |
Correct |
3 ms |
6716 KB |
Output is correct |
26 |
Correct |
4 ms |
6608 KB |
Output is correct |
27 |
Correct |
4 ms |
6452 KB |
Output is correct |
28 |
Correct |
2 ms |
6704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
16608 KB |
Output is correct |
2 |
Correct |
29 ms |
18260 KB |
Output is correct |
3 |
Correct |
3 ms |
6196 KB |
Output is correct |
4 |
Correct |
20 ms |
16444 KB |
Output is correct |
5 |
Correct |
34 ms |
19728 KB |
Output is correct |
6 |
Correct |
37 ms |
19800 KB |
Output is correct |
7 |
Correct |
31 ms |
18932 KB |
Output is correct |
8 |
Correct |
27 ms |
18796 KB |
Output is correct |
9 |
Correct |
34 ms |
19820 KB |
Output is correct |
10 |
Correct |
31 ms |
19852 KB |
Output is correct |
11 |
Correct |
30 ms |
19816 KB |
Output is correct |
12 |
Correct |
30 ms |
19808 KB |
Output is correct |
13 |
Correct |
40 ms |
19992 KB |
Output is correct |
14 |
Correct |
31 ms |
19868 KB |
Output is correct |
15 |
Correct |
34 ms |
19816 KB |
Output is correct |
16 |
Correct |
34 ms |
20084 KB |
Output is correct |
17 |
Correct |
32 ms |
19556 KB |
Output is correct |
18 |
Correct |
41 ms |
19448 KB |
Output is correct |
19 |
Correct |
43 ms |
19448 KB |
Output is correct |
20 |
Correct |
30 ms |
19504 KB |
Output is correct |
21 |
Correct |
37 ms |
19620 KB |
Output is correct |
22 |
Correct |
34 ms |
19464 KB |
Output is correct |
23 |
Correct |
28 ms |
16736 KB |
Output is correct |
24 |
Correct |
32 ms |
16740 KB |
Output is correct |
25 |
Correct |
24 ms |
17520 KB |
Output is correct |
26 |
Correct |
28 ms |
17456 KB |
Output is correct |
27 |
Correct |
38 ms |
18304 KB |
Output is correct |
28 |
Correct |
28 ms |
18384 KB |
Output is correct |
29 |
Correct |
42 ms |
18336 KB |
Output is correct |
30 |
Correct |
28 ms |
18532 KB |
Output is correct |
31 |
Correct |
27 ms |
16784 KB |
Output is correct |
32 |
Correct |
23 ms |
16736 KB |
Output is correct |
33 |
Correct |
26 ms |
17344 KB |
Output is correct |
34 |
Correct |
25 ms |
17504 KB |
Output is correct |
35 |
Correct |
31 ms |
18292 KB |
Output is correct |
36 |
Correct |
30 ms |
18284 KB |
Output is correct |
37 |
Correct |
36 ms |
18268 KB |
Output is correct |
38 |
Correct |
30 ms |
18252 KB |
Output is correct |
39 |
Correct |
27 ms |
18396 KB |
Output is correct |
40 |
Correct |
29 ms |
18276 KB |
Output is correct |
41 |
Correct |
37 ms |
18860 KB |
Output is correct |
42 |
Correct |
30 ms |
18728 KB |
Output is correct |
43 |
Correct |
28 ms |
19024 KB |
Output is correct |
44 |
Correct |
30 ms |
18944 KB |
Output is correct |
45 |
Correct |
28 ms |
18996 KB |
Output is correct |
46 |
Correct |
34 ms |
18992 KB |
Output is correct |
47 |
Correct |
32 ms |
17912 KB |
Output is correct |
48 |
Correct |
38 ms |
17984 KB |
Output is correct |
49 |
Correct |
34 ms |
17956 KB |
Output is correct |
50 |
Correct |
38 ms |
18016 KB |
Output is correct |
51 |
Correct |
33 ms |
17000 KB |
Output is correct |
52 |
Correct |
25 ms |
16992 KB |
Output is correct |
53 |
Correct |
26 ms |
16880 KB |
Output is correct |
54 |
Correct |
27 ms |
17084 KB |
Output is correct |
55 |
Correct |
25 ms |
17012 KB |
Output is correct |
56 |
Correct |
36 ms |
16936 KB |
Output is correct |
57 |
Correct |
25 ms |
16736 KB |
Output is correct |
58 |
Correct |
30 ms |
16732 KB |
Output is correct |
59 |
Correct |
27 ms |
16720 KB |
Output is correct |
60 |
Correct |
28 ms |
16884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
16964 KB |
Output is correct |
2 |
Correct |
30 ms |
17908 KB |
Output is correct |
3 |
Correct |
2 ms |
6200 KB |
Output is correct |
4 |
Correct |
20 ms |
16456 KB |
Output is correct |
5 |
Correct |
31 ms |
19800 KB |
Output is correct |
6 |
Correct |
28 ms |
19848 KB |
Output is correct |
7 |
Incorrect |
25 ms |
18800 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |