# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238461 | DodgeBallMan | Cats or Dogs (JOI18_catdog) | C++14 | 1843 ms | 40172 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 <bits/stdc++.h>
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const int INF = 1e9;
const int N = 1e5 + 10;
int n, par[N], rot[N], lev[N], col[N], sz[N], pos[N], dep[N];
pii pv[N];
vector<int> g[N];
struct node {
vector<int> v;
node() {
v = vector<int>( 4, INF );
v[0] = v[3] = 0;
}
friend node operator+( const node &a, const node &b ) {
node ret;
ret.v = vector<int>( 4, INF );
for( int i = 0 ; i < 4 ; i++ ) for( int j = 0 ; j < 4 ; j++ ) {
int bit = ( i&2 ) + ( j&1 );
int dif = ( i&1 ) != ( (j>>1)&1 );
ret.v[bit] = min( ret.v[bit], a.v[i] + b.v[j] + dif );
}
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |