#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){
pf("%d\n",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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
8448 KB |
Program terminated incorrectly, or you printed something to stdout |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
121 ms |
15448 KB |
Program terminated incorrectly, or you printed something to stdout |
2 |
Halted |
0 ms |
0 KB |
- |