# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080337 | LCJLY | City (JOI17_city) | C++14 | 265 ms | 49716 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;
#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]*260001+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/260001;
int r=S%260001;
int l2=T/260001;
int r2=T%260001;
if(l<=l2&&r>=l2){
return 1;
}
else if(l2<=l&&r2>=l){
return 0;
}
else return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |