# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
212223 | pit4h | Stray Cat (JOI20_stray) | C++14 | 88 ms | 16116 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anthony.h"
#include<bits/stdc++.h>
#define pii pair<int, int>
#define st first
#define nd second
using namespace std;
const int N = 2e4+1;
vector<int> mark;
vector<pii> g[N];
void dfs(int x, int p, bool cur, int len=0) {
//~ cerr<<"dfs: "<<x<<' '<<p<<' '<<cur<<' '<<len<<' '<<g[x].size()<<'\n';
for(auto i: g[x]) {
if(i.st!=p) {
if((int)g[i.st].size()!=2) {
mark[i.nd]=cur;
dfs(i.st, x, 1^cur);
}
else {
mark[i.nd]=cur;
if(g[x].size()!=2 && cur==1) {
len=1;
}
bool nxt;
if(len==0 || len==1 || len==4) nxt=1;
else nxt=0;
dfs(i.st, x, nxt, (len+1)%6);
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |