# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
444868 |
2021-07-15T16:32:53 Z |
kig9981 |
Stray Cat (JOI20_stray) |
C++17 |
|
64 ms |
16488 KB |
#include "Anthony.h"
#include <bits/stdc++.h>
#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif
using namespace std;
vector<pair<int,int>> adj[20000];
int dist[20000];
std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) {
vector<int> X(M,-1);
queue<pair<int,int>> Q;
memset(dist,-1,sizeof(dist));
for(int i=0;i<M;i++) {
adj[U[i]].emplace_back(V[i],i);
adj[V[i]].emplace_back(U[i],i);
}
dist[0]=0;
for(auto[n,t]: adj[0]) {
dist[n]=1; X[t]=0;
Q.emplace(n,t);
}
while(!Q.empty()) {
auto[c,p]=Q.front();
Q.pop();
for(auto[n,t]: adj[c]) {
if(dist[n]==-1) {
dist[n]=dist[c]+1;
if(A==2) {
if(X[p]>1) {
if(adj[c].size()==2) X[t]=(X[p]-1)%6+2;
else X[t]=!(X[p]==3 || X[p]==6 || X[p]==7);
}
else {
if(adj[c].size()==2) X[t]=X[p]+3;
else X[t]=X[p]^1;
}
}
else X[t]=min(dist[c],dist[n])%3;
Q.emplace(n,t);
}
else if(X[t]==-1) X[t]=min(dist[c],dist[n])%3;
}
}
if(A==2) for(auto &p: X) p=p==1 || p==3 || p==6 || p==7;
return X;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif
using namespace std;
int A, r;
bool d;
string s;
void Init(int A, int B) {
::A=A;
r=-1; d=false; s="";
}
int Move(std::vector<int> y) {
if(r!=-1) y[r]++;
if(A==2) {
if(d) {
if(y[0]+y[1]==2) {
y[r]--;
for(int i=0;i<2;i++) if(y[i]) return r=i;
}
for(int i=0;i<2;i++) if(y[i]==1) return r=i;
}
else {
if(y[0]+y[1]>2) {
d=true;
if(r!=-1 && --y[r]==0) return -1;
else {
for(int i=0;i<2;i++) if(y[i]==1 && y[i]+(i==r)==1) return r=i;
}
}
if(y[0]+y[1]==1) {
d=true;
for(int i=0;i<2;i++) if(y[i]) {
if(i==r) return -1;
return r=i;
}
}
if(s.size()==6) {
d=true;
for(int i=0;i<6;i++) {
bool valid=true;
for(int j=0;j<4;j++) valid&=s[(i+j)%6]=='1'-j/2;
if(valid) {
y[r]--;
for(int i=0;i<2;i++) if(y[i]) return r=i;
}
}
return -1;
}
if(r!=-1) y[r]--;
for(int i=0;i<2;i++) if(y[i]) {
s.push_back('0'+i);
return r=i;
}
}
}
else {
for(int i=0;i<3;i++) if(y[i]==0 && y[(i+1)%3]==0) return r=(i+2)%3;
for(int i=0;i<3;i++) if(y[i]==0) return r=(i+1)%3;
}
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:71:1: warning: control reaches end of non-void function [-Wreturn-type]
71 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
15392 KB |
Output is correct |
2 |
Correct |
1 ms |
1000 KB |
Output is correct |
3 |
Correct |
37 ms |
14788 KB |
Output is correct |
4 |
Correct |
56 ms |
16364 KB |
Output is correct |
5 |
Correct |
59 ms |
16488 KB |
Output is correct |
6 |
Correct |
44 ms |
15220 KB |
Output is correct |
7 |
Correct |
44 ms |
15292 KB |
Output is correct |
8 |
Correct |
52 ms |
15904 KB |
Output is correct |
9 |
Correct |
51 ms |
15804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
15392 KB |
Output is correct |
2 |
Correct |
1 ms |
1000 KB |
Output is correct |
3 |
Correct |
37 ms |
14788 KB |
Output is correct |
4 |
Correct |
56 ms |
16364 KB |
Output is correct |
5 |
Correct |
59 ms |
16488 KB |
Output is correct |
6 |
Correct |
44 ms |
15220 KB |
Output is correct |
7 |
Correct |
44 ms |
15292 KB |
Output is correct |
8 |
Correct |
52 ms |
15904 KB |
Output is correct |
9 |
Correct |
51 ms |
15804 KB |
Output is correct |
10 |
Correct |
44 ms |
13352 KB |
Output is correct |
11 |
Correct |
54 ms |
13332 KB |
Output is correct |
12 |
Correct |
40 ms |
13276 KB |
Output is correct |
13 |
Correct |
40 ms |
13224 KB |
Output is correct |
14 |
Correct |
43 ms |
13580 KB |
Output is correct |
15 |
Correct |
46 ms |
13972 KB |
Output is correct |
16 |
Correct |
52 ms |
16060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
13000 KB |
Output is correct |
2 |
Correct |
1 ms |
1012 KB |
Output is correct |
3 |
Correct |
34 ms |
12780 KB |
Output is correct |
4 |
Correct |
52 ms |
14284 KB |
Output is correct |
5 |
Correct |
53 ms |
14320 KB |
Output is correct |
6 |
Correct |
42 ms |
12968 KB |
Output is correct |
7 |
Correct |
44 ms |
13156 KB |
Output is correct |
8 |
Correct |
48 ms |
13560 KB |
Output is correct |
9 |
Correct |
49 ms |
13588 KB |
Output is correct |
10 |
Correct |
47 ms |
13364 KB |
Output is correct |
11 |
Correct |
47 ms |
13340 KB |
Output is correct |
12 |
Correct |
46 ms |
13368 KB |
Output is correct |
13 |
Correct |
47 ms |
13336 KB |
Output is correct |
14 |
Correct |
48 ms |
13720 KB |
Output is correct |
15 |
Correct |
49 ms |
13600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
13000 KB |
Output is correct |
2 |
Correct |
1 ms |
1012 KB |
Output is correct |
3 |
Correct |
34 ms |
12780 KB |
Output is correct |
4 |
Correct |
52 ms |
14284 KB |
Output is correct |
5 |
Correct |
53 ms |
14320 KB |
Output is correct |
6 |
Correct |
42 ms |
12968 KB |
Output is correct |
7 |
Correct |
44 ms |
13156 KB |
Output is correct |
8 |
Correct |
48 ms |
13560 KB |
Output is correct |
9 |
Correct |
49 ms |
13588 KB |
Output is correct |
10 |
Correct |
47 ms |
13364 KB |
Output is correct |
11 |
Correct |
47 ms |
13340 KB |
Output is correct |
12 |
Correct |
46 ms |
13368 KB |
Output is correct |
13 |
Correct |
47 ms |
13336 KB |
Output is correct |
14 |
Correct |
48 ms |
13720 KB |
Output is correct |
15 |
Correct |
49 ms |
13600 KB |
Output is correct |
16 |
Correct |
37 ms |
11540 KB |
Output is correct |
17 |
Correct |
37 ms |
11500 KB |
Output is correct |
18 |
Correct |
38 ms |
11452 KB |
Output is correct |
19 |
Correct |
40 ms |
11644 KB |
Output is correct |
20 |
Correct |
44 ms |
12020 KB |
Output is correct |
21 |
Correct |
41 ms |
11764 KB |
Output is correct |
22 |
Correct |
49 ms |
13764 KB |
Output is correct |
23 |
Correct |
40 ms |
11500 KB |
Output is correct |
24 |
Correct |
40 ms |
11540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1388 KB |
Output is correct |
2 |
Correct |
2 ms |
1128 KB |
Output is correct |
3 |
Correct |
2 ms |
1388 KB |
Output is correct |
4 |
Correct |
2 ms |
1388 KB |
Output is correct |
5 |
Correct |
2 ms |
1392 KB |
Output is correct |
6 |
Correct |
2 ms |
1388 KB |
Output is correct |
7 |
Correct |
2 ms |
1388 KB |
Output is correct |
8 |
Correct |
2 ms |
1388 KB |
Output is correct |
9 |
Correct |
2 ms |
1400 KB |
Output is correct |
10 |
Correct |
2 ms |
1396 KB |
Output is correct |
11 |
Correct |
2 ms |
1432 KB |
Output is correct |
12 |
Correct |
2 ms |
1392 KB |
Output is correct |
13 |
Correct |
2 ms |
1388 KB |
Output is correct |
14 |
Correct |
2 ms |
1388 KB |
Output is correct |
15 |
Correct |
2 ms |
1388 KB |
Output is correct |
16 |
Correct |
2 ms |
1392 KB |
Output is correct |
17 |
Correct |
2 ms |
1388 KB |
Output is correct |
18 |
Correct |
2 ms |
1400 KB |
Output is correct |
19 |
Correct |
2 ms |
1388 KB |
Output is correct |
20 |
Correct |
2 ms |
1388 KB |
Output is correct |
21 |
Correct |
2 ms |
1384 KB |
Output is correct |
22 |
Correct |
2 ms |
1388 KB |
Output is correct |
23 |
Correct |
2 ms |
1388 KB |
Output is correct |
24 |
Correct |
2 ms |
1388 KB |
Output is correct |
25 |
Correct |
2 ms |
1388 KB |
Output is correct |
26 |
Correct |
2 ms |
1388 KB |
Output is correct |
27 |
Correct |
2 ms |
1400 KB |
Output is correct |
28 |
Correct |
2 ms |
1388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
11056 KB |
Output is correct |
2 |
Correct |
44 ms |
11596 KB |
Output is correct |
3 |
Correct |
1 ms |
1128 KB |
Output is correct |
4 |
Correct |
33 ms |
11192 KB |
Output is correct |
5 |
Correct |
49 ms |
12188 KB |
Output is correct |
6 |
Correct |
49 ms |
12216 KB |
Output is correct |
7 |
Correct |
42 ms |
11440 KB |
Output is correct |
8 |
Correct |
42 ms |
11380 KB |
Output is correct |
9 |
Correct |
49 ms |
12124 KB |
Output is correct |
10 |
Correct |
53 ms |
12196 KB |
Output is correct |
11 |
Correct |
48 ms |
12616 KB |
Output is correct |
12 |
Correct |
49 ms |
12660 KB |
Output is correct |
13 |
Correct |
47 ms |
12744 KB |
Output is correct |
14 |
Correct |
48 ms |
12760 KB |
Output is correct |
15 |
Correct |
51 ms |
12612 KB |
Output is correct |
16 |
Correct |
49 ms |
12640 KB |
Output is correct |
17 |
Correct |
49 ms |
12280 KB |
Output is correct |
18 |
Correct |
46 ms |
12376 KB |
Output is correct |
19 |
Correct |
45 ms |
12360 KB |
Output is correct |
20 |
Correct |
64 ms |
12372 KB |
Output is correct |
21 |
Correct |
46 ms |
12308 KB |
Output is correct |
22 |
Correct |
47 ms |
12392 KB |
Output is correct |
23 |
Correct |
40 ms |
11632 KB |
Output is correct |
24 |
Correct |
41 ms |
11628 KB |
Output is correct |
25 |
Correct |
41 ms |
11740 KB |
Output is correct |
26 |
Correct |
41 ms |
11756 KB |
Output is correct |
27 |
Correct |
48 ms |
12068 KB |
Output is correct |
28 |
Correct |
46 ms |
12184 KB |
Output is correct |
29 |
Correct |
47 ms |
12168 KB |
Output is correct |
30 |
Correct |
46 ms |
12072 KB |
Output is correct |
31 |
Correct |
39 ms |
11564 KB |
Output is correct |
32 |
Correct |
39 ms |
11664 KB |
Output is correct |
33 |
Correct |
43 ms |
11816 KB |
Output is correct |
34 |
Correct |
41 ms |
11692 KB |
Output is correct |
35 |
Correct |
46 ms |
12136 KB |
Output is correct |
36 |
Correct |
43 ms |
12140 KB |
Output is correct |
37 |
Correct |
45 ms |
12156 KB |
Output is correct |
38 |
Correct |
43 ms |
12092 KB |
Output is correct |
39 |
Correct |
45 ms |
12176 KB |
Output is correct |
40 |
Correct |
47 ms |
12132 KB |
Output is correct |
41 |
Correct |
47 ms |
12364 KB |
Output is correct |
42 |
Correct |
47 ms |
12224 KB |
Output is correct |
43 |
Correct |
46 ms |
12196 KB |
Output is correct |
44 |
Correct |
46 ms |
12272 KB |
Output is correct |
45 |
Correct |
47 ms |
12344 KB |
Output is correct |
46 |
Correct |
48 ms |
12500 KB |
Output is correct |
47 |
Correct |
50 ms |
12024 KB |
Output is correct |
48 |
Correct |
43 ms |
12016 KB |
Output is correct |
49 |
Correct |
44 ms |
11836 KB |
Output is correct |
50 |
Correct |
43 ms |
12016 KB |
Output is correct |
51 |
Correct |
40 ms |
11800 KB |
Output is correct |
52 |
Correct |
45 ms |
11796 KB |
Output is correct |
53 |
Correct |
43 ms |
11948 KB |
Output is correct |
54 |
Correct |
40 ms |
11832 KB |
Output is correct |
55 |
Correct |
40 ms |
11928 KB |
Output is correct |
56 |
Correct |
39 ms |
11880 KB |
Output is correct |
57 |
Correct |
40 ms |
11756 KB |
Output is correct |
58 |
Correct |
40 ms |
11740 KB |
Output is correct |
59 |
Correct |
42 ms |
11812 KB |
Output is correct |
60 |
Correct |
44 ms |
11796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
11244 KB |
Output is correct |
2 |
Correct |
43 ms |
11420 KB |
Output is correct |
3 |
Correct |
1 ms |
1140 KB |
Output is correct |
4 |
Correct |
33 ms |
11228 KB |
Output is correct |
5 |
Correct |
49 ms |
12224 KB |
Output is correct |
6 |
Correct |
49 ms |
12168 KB |
Output is correct |
7 |
Correct |
43 ms |
11340 KB |
Output is correct |
8 |
Incorrect |
38 ms |
11864 KB |
Wrong Answer [6] |
9 |
Halted |
0 ms |
0 KB |
- |