Submission #926401

#TimeUsernameProblemLanguageResultExecution timeMemory
926401amirhoseinfar1385City (JOI17_city)C++17
22 / 100
329 ms40076 KiB
#include "Encoder.h" #include<bits/stdc++.h> using namespace std; vector<vector<int>>adj; vector<pair<int,int>>stf; int timea=0; void solve(int u,int par=-1){ timea++; stf[u].first=timea; for(auto x:adj[u]){ if(x!=par){ solve(x,u); } } stf[u].second=timea; } void Encode(int N, int A[], int B[]) { adj.clear(); stf.clear(); adj.resize(N+1); stf.resize(N+1); timea=0; for (int i = 0; i < N-1; ++i) { adj[A[i]].push_back(B[i]); adj[B[i]].push_back(A[i]); } solve(0); for(int i=0;i<N;i++){ Code(i,stf[i].first+(stf[i].second*(1ll<<18))); } }
#include "Device.h" #include<bits/stdc++.h> using namespace std; void InitDevice() { } int Answer(long long S, long long T) { pair<long long ,long long>stfs,stft; stfs.first=(((1<<18)-1)&S); stft.first=(((1<<18)-1)&T); S>>=18; T>>=18; stfs.second=S; stft.second=T; if(stft.first>=stfs.first&&stft.second<=stfs.second){ return 1; } if(stfs.first>=stft.first&&stfs.second<=stft.second){ return 0; } return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...