제출 #427067

#제출 시각아이디문제언어결과실행 시간메모리
427067jamezzzCity (JOI17_city)C++17
22 / 100
604 ms41724 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define fi first #define se second #define pb emplace_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() typedef long long ll; typedef pair<int,int> ii; #define maxn 250005 ll pre[maxn],pst[maxn],cnt; vector<int> AL[maxn]; void dfs(int u){ pre[u]=cnt++; for(int v:AL[u]){ if(pre[v]==-1)dfs(v); } pst[u]=cnt-1; } void Encode(int n,int a[],int b[]){ memset(pre,-1,sizeof pre); for(int i=0;i<n-1;++i){ AL[a[i]].pb(b[i]); AL[b[i]].pb(a[i]); } dfs(0); for(int i=0;i<n;++i){ bitset<36> bs((pre[i]<<18)+pst[i]); Code(i,(pre[i]<<18)+pst[i]); } }
#include "Device.h" #include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define fi first #define se second #define pb emplace_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() typedef long long ll; typedef pair<int,int> ii; int ones=(1<<18)-1; void InitDevice(){ } int Answer(ll S, ll T){ ll pstS=S&ones,pstT=T&ones; S>>=18;T>>=18; if(T<=S&&S<=pstT)return 0; if(S<=T&&T<=pstS)return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...