# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
128523 | briansu | City (JOI17_city) | C++14 | 591 ms | 80720 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
#define REP(i, n) for(int i = 0;i < n;i ++)
#define REP1(i, n) for(int i = 1;i <= n;i ++)
#define FILL(i, n) memset(i, n, sizeof(i))
#define X first
#define Y second
#define pb push_back
#define SZ(_a) ((int)(_a).size())
#define ALL(_a) (_a).begin(), (_a).end()
#ifdef brian
#define IOS()
template<typename T>static void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...t>static void _do(T &&x, t &&...X){cerr<<x<<", ";_do(X...);}
#define debug(...) {\
fprintf(stderr, "%s - %d (%s) = ", __PRETTY_FUNCTION__, __LINE__, #__VA_ARGS__);\
_do(__VA_ARGS__);\
}
#else
#define debug(...)
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#endif
const ll MAXn = 3e5 + 5;
const ll INF = ll(1e17);
vector<ll> v[MAXn];
ll n, tit = 0, in[MAXn], out[MAXn];
void dfs(ll now,ll f)
{
in[now] = tit ++;
for(ll k:v[now])if(k != f)dfs(k, now);
out[now] = tit - 1;
}
void Encode(int N, int A[], int B[])
{
n = N;
REP(i, n - 1)v[A[i]].pb(B[i]), v[B[i]].pb(A[i]);
dfs(0, -1);
REP(i, n)Code(i, in[i] + (out[i] << 18));
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
#define REP(i, n) for(int i = 0;i < n;i ++)
#define REP1(i, n) for(int i = 1;i <= n;i ++)
#define FILL(i, n) memset(i, n, sizeof(i))
#define X first
#define Y second
#define pb push_back
#define SZ(_a) ((int)(_a).size())
#define ALL(_a) (_a).begin(), (_a).end()
#ifdef brian
#define IOS()
template<typename T>static void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...t>static void _do(T &&x, t &&...X){cerr<<x<<", ";_do(X...);}
#define debug(...) {\
fprintf(stderr, "%s - %d (%s) = ", __PRETTY_FUNCTION__, __LINE__, #__VA_ARGS__);\
_do(__VA_ARGS__);\
}
#else
#define debug(...)
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#endif
void InitDevice()
{
}
int Answer(long long S, long long T)
{
ll a = S & ((1 << 18) - 1), b = (S >> 18);
ll c = T & ((1 << 18) - 1), d = (T >> 18);
debug(a, b, c, d);
if(a < c && d <= b)return 1;
else if(c < a && b <= d)return 0;
else return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |