제출 #1080338

#제출 시각아이디문제언어결과실행 시간메모리
1080338kwongwengCity (JOI17_city)C++17
22 / 100
259 ms49924 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef long long ll; #define FOR(i,a,b) for(int i=a; i<b; i++) #define ROF(i,a,b) for(int i=a; i>=b; i--) #define pb push_back const ll N = 250001; vi g[N], p(N); vector<ll> sz(N), tin(N); int cnt = 0; void dfs(int u){ tin[u] = cnt++; sz[u]=1; for (int v : g[u]){ if (p[u]==v) continue; p[v]=u; dfs(v); sz[u] += sz[v]; } Code(u,tin[u]*N + sz[u]); } void Encode(int n, int A[], int B[]) { FOR(i,0,n-1){ g[A[i]].pb(B[i]); g[B[i]].pb(A[i]); } dfs(0); }
#include "Device.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef long long ll; #define FOR(i,a,b) for(int i=a; i<b; i++) #define ROF(i,a,b) for(int i=a; i>=b; i--) #define pb push_back const ll N = 250001; void InitDevice() { } int Answer(long long S, long long T) { //cout<<S/N<<" "<<S%N<<" "<<T/N<<" "<<T%N<<"\n"; if (S<T){ if (T/N < S/N + S%N) return 1; return 2; } if (S/N < T/N + T%N) return 0; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...