Submission #1080322

#TimeUsernameProblemLanguageResultExecution timeMemory
1080322LCJLYCity (JOI17_city)C++14
8 / 100
355 ms42220 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; #define int long long //#define ld long double #define show(x,y) cout << y << " " << #x << endl; #define show2(x,y,i,j) cout << y << " " << #x << " " << j << " " << #i << endl; #define show3(x,y,i,j,p,q) cout << y << " " << #x << " " << j << " " << #i << " " << q << " " << #p << endl; #define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl; typedef pair<int,int>pii; typedef pair<pii,int>pi2; //mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count()); //Code(index,val) vector<int>adj[250005]; int in[250005]; int out[250005]; int ptr=-1; void dfs(int index, int par){ in[index]=++ptr; for(auto it:adj[index]){ if(it==par) continue; dfs(it,index); } out[index]=ptr; } void Encode(int32_t N, int32_t A[], int32_t B[]){ for(int x=0;x<N;x++){ adj[A[x]].push_back(B[x]); adj[B[x]].push_back(A[x]); } dfs(0,-1); for(int x=0;x<N;x++){ Code(x,in[x]*250001+out[x]); } }
#include "Device.h" #include <bits/stdc++.h> using namespace std; #define int long long //#define ld long double #define show(x,y) cout << y << " " << #x << endl; #define show2(x,y,i,j) cout << y << " " << #x << " " << j << " " << #i << endl; #define show3(x,y,i,j,p,q) cout << y << " " << #x << " " << j << " " << #i << " " << q << " " << #p << endl; #define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl; typedef pair<int,int>pii; typedef pair<pii,int>pi2; //mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count()); void InitDevice(){ } int32_t Answer(long long S, long long T){ int l=S/250001; int r=S%250001; int l2=T/250001; int r2=T%250001; if(l<=l2&&r>=l2){ return 1; } else if(l2<=l&&r2>=l){ return 0; } else return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...