Submission #67269

#TimeUsernameProblemLanguageResultExecution timeMemory
67269ikura355City (JOI17_city)C++14
22 / 100
562 ms56656 KiB
#include "Encoder.h" #include<bits/stdc++.h> using namespace std; #define ll long long const int maxn = 250000 + 5; int n; vector<int> way[maxn]; int cur, st[maxn], ft[maxn]; void dfs(int u, int last) { st[u] = ++cur; for(auto v : way[u]) { if(v==last) continue; dfs(v,u); } ft[u] = cur; } void Encode(int N, int A[], int B[]) { n = N; for(int i=0;i<n-1;i++) { way[A[i]].push_back(B[i]); way[B[i]].push_back(A[i]); } cur = -1; dfs(0,-1); for(int i=0;i<n;i++) Code(i,(ll)st[i]*(1<<18) + ft[i]); }
#include "Device.h" #include<bits/stdc++.h> using namespace std; void InitDevice() { } int Answer(long long S, long long T) { int lu = S/(1<<18), ru = S%(1<<18); int lv = T/(1<<18), rv = T%(1<<18); if(lv<=lu && lu<=rv) return 0; if(lu<=lv && lv<=ru) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...