# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
996573 |
2024-06-10T20:05:50 Z |
TimDee |
Stray Cat (JOI20_stray) |
C++17 |
|
35 ms |
17780 KB |
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<(n); ++i)
#define pb push_back
#define pi pair<int,int>
#define f first
#define s second
const int N=2e4+5;
vector<pi> adj[N];
int z[N];
int c[N];
int ed[N];
vector<int> ptrn={0,1,1,0,0,0,1,0,0,1,1,1};
void dfs(int u, int p) {
for(auto&e:adj[u]) {
int v=e.f, i=e.s;
if (v==p) continue;
if (adj[v].size()==2) {
z[v]=z[u]+1;
c[v]=ptrn[z[u]%12];
ed[i]=ptrn[z[u]%12];
} else {
z[v]=c[u]*6;
c[v]=c[u]^1;
ed[i]=c[u]^1;
}
dfs(v,u);
}
}
vector<int> Mark(int n, int m, int A, int B, vector<int> u, vector<int> v) {
if (m > n-1) exit(0);
forn(i,m) adj[u[i]].pb({v[i],i}), adj[v[i]].pb({u[i],i});
dfs(0,-1);
vector<int> ans(m);
forn(i,m) ans[i]=ed[i];
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<(n); ++i)
#define pb push_back
#define pi pair<int,int>
#define f first
#define s second
int fmove=1;
int rdir=0;
int last=-1;
void Init(int A, int B) {
}
vector<int> ok;
vector<int> ptn={0,1,1,0,0,0,1,0,0,1,1,1};
int Move(vector<int> a) {
if (fmove) {
fmove=0;
if (a[0]+a[1] == 1) {
rdir=1;
if (a[0]) return last=0;
if (a[1]) return last=1;
assert(0);
}
if (a[0]+a[1]>2) {
rdir=1;
if (a[0]==1) return last=0;
if (a[1]==1) return last=1;
assert(0);
}
for(int i=1; i>=0; --i) forn(j,a[i]) ok.pb(i);
forn(i,2) if (a[i]) return last=i;
assert(0);
}
if (rdir) {
if (!(a[0]+a[1])) return -1;
assert(a[0]+a[1]);
if (a[0]+a[1]==1) forn(i,2) if (a[i]) return last=i;
assert(a[last^1]);
return last^=1;
}
if (a[0]+a[1]==0) {
rdir = 1;
return -1;
}
if (a[0]+a[1] > 1) {
if (a[0] && a[1]) {
rdir=1;
return last^=1;
}
rdir=1;
return -1;
}
if (a[0]) {
ok.pb(0);
} else {
ok.pb(1);
}
if (ok.size()==6) {
int kk=0;
forn(i,12) {
int z=1;
forn(j,6) z&=ok[j]==ptn[(i+j)%12];
kk|=z;
}
if (kk) {
rdir=1;
return -1;
}
rdir=1;
return last=ok.back();
}
return last=ok.back();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
16212 KB |
Output is correct |
2 |
Correct |
1 ms |
1308 KB |
Output is correct |
3 |
Correct |
26 ms |
15244 KB |
Output is correct |
4 |
Correct |
33 ms |
17664 KB |
Output is correct |
5 |
Correct |
31 ms |
17780 KB |
Output is correct |
6 |
Correct |
25 ms |
15728 KB |
Output is correct |
7 |
Correct |
31 ms |
15596 KB |
Output is correct |
8 |
Incorrect |
28 ms |
17020 KB |
Wrong Answer [6] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
16212 KB |
Output is correct |
2 |
Correct |
1 ms |
1308 KB |
Output is correct |
3 |
Correct |
26 ms |
15244 KB |
Output is correct |
4 |
Correct |
33 ms |
17664 KB |
Output is correct |
5 |
Correct |
31 ms |
17780 KB |
Output is correct |
6 |
Correct |
25 ms |
15728 KB |
Output is correct |
7 |
Correct |
31 ms |
15596 KB |
Output is correct |
8 |
Incorrect |
28 ms |
17020 KB |
Wrong Answer [6] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
13948 KB |
Output is correct |
2 |
Correct |
1 ms |
1296 KB |
Output is correct |
3 |
Correct |
23 ms |
12944 KB |
Output is correct |
4 |
Correct |
28 ms |
15480 KB |
Output is correct |
5 |
Correct |
33 ms |
15396 KB |
Output is correct |
6 |
Correct |
26 ms |
13692 KB |
Output is correct |
7 |
Correct |
31 ms |
13508 KB |
Output is correct |
8 |
Incorrect |
31 ms |
14676 KB |
Wrong Answer [6] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
13948 KB |
Output is correct |
2 |
Correct |
1 ms |
1296 KB |
Output is correct |
3 |
Correct |
23 ms |
12944 KB |
Output is correct |
4 |
Correct |
28 ms |
15480 KB |
Output is correct |
5 |
Correct |
33 ms |
15396 KB |
Output is correct |
6 |
Correct |
26 ms |
13692 KB |
Output is correct |
7 |
Correct |
31 ms |
13508 KB |
Output is correct |
8 |
Incorrect |
31 ms |
14676 KB |
Wrong Answer [6] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1564 KB |
Output is correct |
2 |
Correct |
1 ms |
1308 KB |
Output is correct |
3 |
Correct |
1 ms |
1560 KB |
Output is correct |
4 |
Correct |
2 ms |
1568 KB |
Output is correct |
5 |
Correct |
1 ms |
1560 KB |
Output is correct |
6 |
Correct |
2 ms |
1564 KB |
Output is correct |
7 |
Correct |
1 ms |
1568 KB |
Output is correct |
8 |
Correct |
2 ms |
1568 KB |
Output is correct |
9 |
Correct |
2 ms |
1568 KB |
Output is correct |
10 |
Correct |
1 ms |
1560 KB |
Output is correct |
11 |
Correct |
1 ms |
1572 KB |
Output is correct |
12 |
Correct |
1 ms |
1568 KB |
Output is correct |
13 |
Correct |
2 ms |
1572 KB |
Output is correct |
14 |
Correct |
1 ms |
1568 KB |
Output is correct |
15 |
Correct |
1 ms |
1560 KB |
Output is correct |
16 |
Correct |
1 ms |
1556 KB |
Output is correct |
17 |
Correct |
1 ms |
1568 KB |
Output is correct |
18 |
Correct |
2 ms |
1560 KB |
Output is correct |
19 |
Correct |
1 ms |
1576 KB |
Output is correct |
20 |
Correct |
1 ms |
1568 KB |
Output is correct |
21 |
Correct |
2 ms |
1568 KB |
Output is correct |
22 |
Correct |
1 ms |
1568 KB |
Output is correct |
23 |
Correct |
2 ms |
1572 KB |
Output is correct |
24 |
Correct |
1 ms |
1560 KB |
Output is correct |
25 |
Correct |
1 ms |
1568 KB |
Output is correct |
26 |
Correct |
1 ms |
1568 KB |
Output is correct |
27 |
Correct |
1 ms |
1540 KB |
Output is correct |
28 |
Correct |
1 ms |
1564 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
11596 KB |
Output is correct |
2 |
Correct |
27 ms |
12664 KB |
Output is correct |
3 |
Correct |
1 ms |
1308 KB |
Output is correct |
4 |
Correct |
23 ms |
11400 KB |
Output is correct |
5 |
Correct |
32 ms |
13820 KB |
Output is correct |
6 |
Correct |
27 ms |
13948 KB |
Output is correct |
7 |
Correct |
24 ms |
13176 KB |
Output is correct |
8 |
Correct |
26 ms |
13644 KB |
Output is correct |
9 |
Correct |
27 ms |
14412 KB |
Output is correct |
10 |
Correct |
34 ms |
14884 KB |
Output is correct |
11 |
Correct |
28 ms |
14488 KB |
Output is correct |
12 |
Correct |
30 ms |
14296 KB |
Output is correct |
13 |
Correct |
32 ms |
14280 KB |
Output is correct |
14 |
Correct |
26 ms |
14664 KB |
Output is correct |
15 |
Correct |
30 ms |
14380 KB |
Output is correct |
16 |
Correct |
30 ms |
14408 KB |
Output is correct |
17 |
Correct |
26 ms |
14160 KB |
Output is correct |
18 |
Correct |
26 ms |
14160 KB |
Output is correct |
19 |
Correct |
32 ms |
14224 KB |
Output is correct |
20 |
Correct |
26 ms |
14064 KB |
Output is correct |
21 |
Correct |
26 ms |
14132 KB |
Output is correct |
22 |
Correct |
28 ms |
14164 KB |
Output is correct |
23 |
Correct |
24 ms |
11844 KB |
Output is correct |
24 |
Correct |
25 ms |
11848 KB |
Output is correct |
25 |
Correct |
25 ms |
12356 KB |
Output is correct |
26 |
Correct |
26 ms |
12384 KB |
Output is correct |
27 |
Correct |
28 ms |
13396 KB |
Output is correct |
28 |
Correct |
30 ms |
13332 KB |
Output is correct |
29 |
Correct |
33 ms |
13384 KB |
Output is correct |
30 |
Correct |
25 ms |
13484 KB |
Output is correct |
31 |
Correct |
29 ms |
11972 KB |
Output is correct |
32 |
Incorrect |
22 ms |
11860 KB |
Wrong Answer [6] |
33 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
11636 KB |
Output is correct |
2 |
Correct |
24 ms |
12412 KB |
Output is correct |
3 |
Correct |
1 ms |
1304 KB |
Output is correct |
4 |
Correct |
19 ms |
11424 KB |
Output is correct |
5 |
Correct |
33 ms |
13804 KB |
Output is correct |
6 |
Correct |
28 ms |
13948 KB |
Output is correct |
7 |
Correct |
27 ms |
13176 KB |
Output is correct |
8 |
Correct |
24 ms |
13176 KB |
Output is correct |
9 |
Correct |
30 ms |
13928 KB |
Output is correct |
10 |
Correct |
30 ms |
13912 KB |
Output is correct |
11 |
Correct |
27 ms |
13948 KB |
Output is correct |
12 |
Correct |
35 ms |
13948 KB |
Output is correct |
13 |
Correct |
31 ms |
13952 KB |
Output is correct |
14 |
Correct |
34 ms |
13912 KB |
Output is correct |
15 |
Incorrect |
27 ms |
13940 KB |
Wrong Answer [6] |
16 |
Halted |
0 ms |
0 KB |
- |