Submission #1058829

#TimeUsernameProblemLanguageResultExecution timeMemory
1058829jamjanekCity (JOI17_city)C++14
22 / 100
188 ms53772 KiB
#include "Encoder.h" #include<bits/stdc++.h> using namespace std; vector<int>graf[250010]; int preorder[250010], post[250010], preit, postit; void dfs(int x, int o){ preorder[x]=preit++; for(auto j: graf[x]) if(j!=o) dfs(j, x); post[x]=postit++; } void Encode(int n, int A[], int B[]) { int i; for(i=0;i<n-1;i++){ graf[A[i]].push_back(B[i]); graf[B[i]].push_back(A[i]); } dfs(0,-1); for (int i = 0; i < n; ++i) { Code(i, (long long)preorder[i]*250000+post[i]); } }
#include "Device.h" #include<bits/stdc++.h> using namespace std; void InitDevice() { } int Answer(long long S, long long T) { int X1=S/250000, X2=S%250000; int Y1=T/250000, Y2=T%250000; if(X1<=Y1 && X2>=Y2)return 1; if(Y1<=X1 && Y2>=X2)return 0; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...