Submission #934023

#TimeUsernameProblemLanguageResultExecution timeMemory
934023logangdCity (JOI17_city)C++14
0 / 100
124 ms23328 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 p=t; Code(u,(t<<18)+t); t++; return {t-1,t-1}; } 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 l1=S>>18,r1=S-(l1<<18); ll l2=T>>18,r2=T-(l2<<18); if(l2<=l1&&r1<=r2)return 0; if(l1<=l2&&r2<=r1)return 1; return 2; }

Compilation message (stderr)

Encoder.cpp: In function 'std::pair<long long int, long long int> dfs(ll, ll)':
Encoder.cpp:16:6: warning: unused variable 'p' [-Wunused-variable]
   16 |   ll p=t;
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...