# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
427067 | jamezzz | City (JOI17_city) | C++17 | 604 ms | 41724 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |