Submission #934103

#TimeUsernameProblemLanguageResultExecution timeMemory
934103efishelCity (JOI17_city)C++17
18 / 100
336 ms34088 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 &timer) { codes[u] |= timer; timer++; for (ll v : adj[u]) { if (v == par) continue; dfs(v, u, adj, codes, timer); } codes[u] |= timer<<19; timer++; } 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 tinu = code1&((1<<19)-1), toutu = code1>>19; ll tinv = code2&((1<<19)-1), toutv = code2>>19; // cerr << code1 << ' ' << code2 << '\n'; // cerr << u << ' ' << v << "\n\n"; if (tinv <= tinu && toutu <= toutv) return 0; if (tinu <= tinv && toutv <= toutu) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...