# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934103 | efishel | City (JOI17_city) | C++17 | 336 ms | 34088 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>
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |