제출 #934029

#제출 시각아이디문제언어결과실행 시간메모리
934029logangdCity (JOI17_city)C++14
0 / 100
125 ms22040 KiB
#include "Encoder.h" #include<iostream> #include<vector> using namespace std; using ll=long long; using vl=vector<ll>; const int Mx = 250000; ll t=0; vl ad[Mx]; pair<ll,ll>dfs(ll u,ll p){ if(u!=0&&ad[u].size()==1){ ll k=t++; ll it=1<<18; Code(u,k*it+k); return {k,k}; } ll l=Mx,r=0; for(auto i:ad[u]){ if(i!=p){ auto rt=dfs(i,u); l=min(l,rt.first); r=max(r,rt.second); } } Code(u,(l<<18)+r); return {l,r}; } void Encode(int N, int A[], int B[]){ for(int i=0;i<N-1;i++) ad[A[i]].push_back(B[i]), ad[B[i]].push_back(A[i]); dfs(0,-1); }
#include "Device.h" using ll=long long; void InitDevice(){} int Answer(long long S, long long T){ ll it=1<<18; ll l1=S/it,r1=S-l1*it; ll l2=T/it,r2=T-l2*it; if(l2<=l1&&r1<=r2)return 0; if(l1<=l2&&r2<=r1)return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...