# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
699568 | urosk | City (JOI17_city) | C++14 | 395 ms | 61544 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Encoder.h"
#include "bits/stdc++.h"
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#define ld double
#define ll int
#define llinf 100000000000000000LL // 10^17
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) (ll)(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}
#define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);
using namespace std;
#define maxn 700005
ll n;
vector<ll> g[maxn];
ll in[maxn],ti = 0;
void dfs(ll u,ll p){
in[u] = ++ti;
for(ll s : g[u]) if(s^p) dfs(s,u);
double cur = 1.0,w = 1.05;
ll ans = 0;
while((ll)cur<ti-in[u]) cur*=w,ans++;
ti = in[u] + (ll)(cur);
Code(u,maxn*ans+in[u]);
}
void Encode(int N, int A[], int B[])
{
n = N;
for(ll i = 0;i<n-1;i++){
ll x = A[i],y = B[i];
g[x].pb(y);
g[y].pb(x);
}
dfs(0,0);
}
#include "Device.h"
#include "bits/stdc++.h"
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#define ld double
#define ll long long
#define llinf 100000000000000000LL // 10^17
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) (ll)(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}
#define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);
using namespace std;
#define maxx 1005
#define maxn 700005
ll len[maxx];
void InitDevice()
{
double cur = 1.0,w =1.05;
len[0] = cur;
for(ll i = 1;i<maxx;i++){
cur*=w;
len[i] = (ll)(cur);
}
}
int Answer(ll u,ll v)
{
ll inu = u%maxn,inv = v%maxn;
ll outu = inu + len[u/maxn],outv = inv + len[v/maxn];
if(inv>=inu&&outu>=outv) return 1;
if(inv<=inu&&outu<=outv) return 0;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |