제출 #551909

#제출 시각아이디문제언어결과실행 시간메모리
551909LucaDantasCity (JOI17_city)C++17
8 / 100
197 ms27468 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; constexpr int maxn = 1<<18; vector<int> g[maxn]; int t, in[maxn], out[maxn]; void dfs(int u, int p) { in[u] = ++t; for(int v : g[u]) if(v != p) dfs(v, u); out[u] = t; // printf("%d -> %d %d\n", u, in[u], out[u]); } void Encode(int N, int A[], int B[]) { for(int i = 0; i < N-1; i++) g[A[i]].push_back(B[i]), g[B[i]].push_back(A[i]); dfs(0, -1); for (int i = 0; i < N; ++i) Code(i, in[i] | (out[i] << 18)); }
#include "Device.h" #include <bits/stdc++.h> using namespace std; void InitDevice() { } int Answer(long long S, long long T) { long long in[2], out[2]; for(int rep = 0; rep < 2; rep++, swap(S, T)) { out[rep] = S >> 18; in[rep] = S ^ (out[rep] << 18); } int vira = 0; if(in[0] > in[1]) swap(in[0], in[1]), swap(out[0], out[1]), vira = 1; /* printf("%lld %lld | %lld %lld\n", in[0], out[0], in[1], out[1]); printf("%d\n\n", out[0] >= in[1] ? 1^vira : 2); */ return (out[0] >= in[1] ? 1^vira : 2); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...