제출 #551933

#제출 시각아이디문제언어결과실행 시간메모리
551933LoboCity (JOI17_city)C++17
22 / 100
391 ms45032 KiB
#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;

const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

const int maxn = 3e5+10;

int tin[maxn], tout[maxn], timer;
vector<int> g[maxn];

void dfs(int u, int ant) {
    tin[u] = ++timer;
    for(auto v : g[u]) if(v != ant) {
        dfs(v,u);
    }
    tout[u] = timer;
}
int mxv = (1<<18);
void Encode(int32_t N, int32_t A[], int32_t B[]) {
    for(int i = 0; i < N-1; i++) {
        g[A[i]].pb(B[i]);
        g[B[i]].pb(A[i]);
    }
    dfs(0,0);

    for(int i = 0; i < N; i++) {
        // cout << i << " " << 1000000*tin[i]+tout[i] << endl;
        Code(i,mxv*tin[i]+tout[i]);
    }
}

// int32_t main() {
//     ios::sync_with_stdio(false); cin.tie(0);

//     freopen("in.in", "r", stdin);
//     // freopen("out.out", "w", stdout);
   
//     int32_t n; cin >> n;
//     int32_t a[n-1],b[n-1];
//     for(int i = 0; i < n-1; i++) {
//         cin >> a[i] >> b[i];
//     }
//     Encode(n,a,b);

// }
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;

const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

const int maxn = -1;

void InitDevice() {}
int mxv = (1<<18);
int32_t Answer(int S, int T) {
    int in1 = S/(mxv);
    int out1 = S-in1*mxv;
    int in2 = T/(mxv);
    int out2 = T-in2*mxv;
    
    if(in1 <= in2 && out1 >= out2) {
        return 1;
    }
    else if(in2 <= in1 && out2 >= out1) {
        return 0;
    }
    else {
        return 2;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...