Submission #1008992

#TimeUsernameProblemLanguageResultExecution timeMemory
1008992salmonCity (JOI17_city)C++14
8 / 100
223 ms41040 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; vector<int> adjlst[250100]; long long int pre[250100]; long long int post[250100]; int cont = 0; void dfs(int i, int p){ pre[i] = cont; cont++; for(int j : adjlst[i]){ if(j == p) continue; dfs(j,i); } post[i] = cont - 1; } void Encode(int N, int A[], int B[]){ for(int i = 0; i < N; ++i) { adjlst[A[i]].push_back(B[i]); adjlst[B[i]].push_back(A[i]); } dfs(0,-1); for(int i = 0; i < N; i++){ Code(i,(pre[i]<<18)+post[i]); } }
#include "Device.h" void InitDevice(){ } int Answer(long long S, long long T){ int e1 = S % (1<<18); int s1 = (S>>18); int e2 = T % (1<<18); int s2 = (T>>18); if(s1 <= s2 && e2 <= e1){ return 1; } if(s2 <= s1 && e1 <= e2){ return 0; } return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...