Submission #225948

#TimeUsernameProblemLanguageResultExecution timeMemory
225948balbitCity (JOI17_city)C++14
22 / 100
529 ms73328 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define SZ(x) (int)(x.size()) #define ALL(x) x.begin(),x.end() #define pb push_back #ifdef BALBIT #define bug(...) cerr<<__LINE__<<": "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__) template<typename T> void _do(T && x){cerr<<x<<endl;} template<typename T, typename ...S> void _do(T && x, S&&...y){cerr<<x<<", "; _do(y...);} #define IOS() #else #define IOS() ios::sync_with_stdio(0),cin.tie(0) #define endl '\n' #define bug(...) #endif // BALBIT const int maxn = 3e5+5; vector<int> g[maxn]; ll ord[maxn]; int it = 0; static ll nm = 250000; void dfs(int v, int p) { ord[v] = it++; for (int u : g[v]) { if (u != p) { dfs(u,v); } } Code(v, nm*(ll)ord[v] + it-1); } void Encode(int N, int A[], int B[]) { // n=N; for (int i = 0; i < N-1; ++i) { g[A[i]].pb(B[i]); g[B[i]].pb(A[i]); } dfs(0,-1); } #ifdef BALBIT signed main(){ bug(1,2,3); } #endif
#include "Device.h" #define ll long long static int nm = 250000; void InitDevice() { } int Answer(long long S, long long T) { ll sin = S/nm, sout = S%nm; ll tin = T/nm, tout = T%nm; if (sin <= tin && sout >= tout) return 1; if (tin <= sin && tout >= sout) return 0; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...