제출 #427160

#제출 시각아이디문제언어결과실행 시간메모리
427160lycCity (JOI17_city)C++14
8 / 100
261 ms27156 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " :: " << x << endl #define _ << " " << #define SZ(x) ((int)(x).size()) #define ALL(x) (x).begin(),(x).end() #define FOR(i,a,b) for(int i=(a);i<=(b);++i) #define RFOR(i,a,b) for(int i=(a);i>=(b);--i) typedef long long ll; typedef pair<int,int> ii; const int mxN = 250001; int N; vector<int> al[mxN]; int pre[mxN], pst[mxN], cnt; void dfs(int u, int p) { pre[u] = cnt++; for (int& v : al[u]) if (v != p) { dfs(v,u); } pst[u] = cnt; //TRACE(u _ pre[u] _ pst[u]); } void Encode(int N, int A[], int B[]) { FOR(i,0,N-2){ al[A[i]].push_back(B[i]); al[B[i]].push_back(A[i]); } dfs(0,-1); for (int i = 0; i < N; ++i) { Code(i, pre[i] | (ll)(pst[i]<<18)); } }
#include "Device.h" #include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " :: " << x << endl #define _ << " " << #define SZ(x) ((int)(x).size()) #define ALL(x) (x).begin(),(x).end() #define FOR(i,a,b) for(int i=(a);i<=(b);++i) #define RFOR(i,a,b) for(int i=(a);i>=(b);--i) typedef long long ll; typedef pair<int,int> ii; const int MN = 1e6+5; const int mod = 1e9+7; void InitDevice() { } int Answer(long long S, long long T) { int a1 = S&((1<<18)-1), a2 = S>>18; int b1 = T&((1<<18)-1), b2 = T>>18; //TRACE(a1 _ a2 _ b1 _ b2); if (a2 <= b1 || b2 <= a1) return 2; if (a1 < b1 && b2 <= a2) return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...