# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
926401 | amirhoseinfar1385 | City (JOI17_city) | C++17 | 329 ms | 40076 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |