Submission #934097

#TimeUsernameProblemLanguageResultExecution timeMemory
934097efishelCity (JOI17_city)C++17
8 / 100
2 ms5396 KiB
#include <bits/stdc++.h> #include "Encoder.h" using namespace std; using ll = long long; using vll = vector <ll>; static void dfs (ll u, ll par, vector <vll> &adj, vll &codes, ll cancs) { codes[u] = cancs | (u<<10); cancs |= (1<<u); for (ll v : adj[u]) { if (v == par) continue; dfs(v, u, adj, codes, cancs); } } void Encode (int N, int u[], int v[]) { vector <vll> adj(N+2, vll(0)); for (ll i = 0; i < N-1; i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } ll cancs=0; vll codes(N+2, 0); dfs(0, 0, adj, codes, cancs); for (int i = 0; i < N; ++i) { Code(i, codes[i]); } }
#include <bits/stdc++.h> #include "Device.h" using namespace std; using ll = long long; using vll = vector <ll>; void InitDevice() { ; } int Answer (long long code1, long long code2) { ll u = code1>>10; ll v = code2>>10; // cerr << code1 << ' ' << code2 << '\n'; // cerr << u << ' ' << v << "\n\n"; if (code1&(1<<v)) return 0; if (code2&(1<<u)) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...