# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
996556 |
2024-06-10T19:24:30 Z |
TimDee |
Stray Cat (JOI20_stray) |
C++17 |
|
29 ms |
26480 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;
}
}
}
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(a[j]);
forn(i,2) if (a[i]) return last=i;
//assert(0);
}
if (rdir) {
assert(a[0]+a[1]);
if (a[0]+a[1]==1) forn(i,2) if (a[i]) return last=i;
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 last;
}
if (a[0]) {
ok.pb(0);
} else {
ok.pb(1);
}
if (ok.size()==6) {
int kk=0;
forn(i,6) {
int z=1;
forn(j,6) z&=ok[j]==ptn[i+j];
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 |
Runtime error |
29 ms |
26480 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
29 ms |
26480 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
21728 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
21728 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
1820 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
10872 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
11132 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |