Submission #470950

#TimeUsernameProblemLanguageResultExecution timeMemory
470950flappybirdCity (JOI17_city)C++14
22 / 100
557 ms58372 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> adj[303030]; ll ord[303030], e[303030]; ll cnt; void dfs(ll x, ll p = 0) { ord[x] = cnt++; e[x] = ord[x]; for (auto v : adj[x]) { if (v == p) continue; dfs(v, x); e[x] = max(e[x], e[v]); } } void Encode(int N, int A[], int B[]) { ll i; for (i = 0; i < N - 1; i++) adj[A[i]].push_back(B[i]), adj[B[i]].push_back(A[i]); dfs(0); for (i = 0; i < N; i++) Code(i, ord[i] * 250001 + e[i]); }
#include "Device.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; void InitDevice() { } int Answer(long long S, long long T) { ll o1, e1, o2, e2; o1 = S / 250001; o2 = T / 250001; e1 = S % 250001; e2 = T % 250001; if (o1 < o2 && e2 <= e1) return 1; else if (o1 > o2 && e2 >= e1) return 0; else return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...