Submission #67270

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
672702018-08-13 18:42:58ikura355City (JOI17_city)C++14
22 / 100
536 ms60680 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];
ll 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);
ll wow = (1<<18);
for(int i=0;i<n;i++) Code(i,st[i]*wow + ft[i]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...