제출 #318543

#제출 시각아이디문제언어결과실행 시간메모리
318543mohamedsobhi777City (JOI17_city)C++14
18 / 100
521 ms61748 KiB
#include <bits/stdc++.h>
#include "Encoder.h"

const int MAX = 5e5;
using namespace std;

vector<int> adj[MAX];
long long st[MAX], en[MAX], T;
const int L = 500000 + 1 ; 
void dfs(int x, int p)
{
        st[x] = ++T;
        for (auto u : adj[x])
        {
                if (u == p)
                        continue;
                dfs(u, x);
        }
        en[x] = ++T;
        Code(x, 1ll * st[x] * L + en[x]);
}

void Encode(int N, int A[], int B[])
{
        for (int i = 0; i < N - 1; ++i)
        {
                adj[A[i]].push_back(B[i]);
                adj[B[i]].push_back(A[i]);
        }
        dfs(0, 0);
}
#include "Device.h"

const int L =  500000 + 1  ; 

void InitDevice()
{
}

int Answer(long long S, long long T)
{
        long long s1 = S / L, t1 = S % L;
        long long s2 = T / L, t2 = T % L;

        if(s2>= s1 && t2 <= t1)return 1;
        if(s1 >= s2 && t1 <= t2) return 0; 
        return 2;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...