# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934071 | sopaconk | City (JOI17_city) | C++17 | 280 ms | 33416 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 pb push_back
#define deb(x) ;
using lli=long long int;
static lli aux=0;
void dfs(int n , int par, vector<vector<int>> &adj, vector<pair<lli,lli>> &range ){
lli ini=aux;
aux++;
for(int x: adj[n]){
if(x==par) continue;
dfs(x, n, adj, range);
}
lli fin=aux;
aux++;
range[n]={ini, fin};
}
void Encode(int N, int A[], int B[])
{
vector<vector<int>> adj (N);
for(int i=0; i<N-1; ++i){
adj[A[i]].pb(B[i]);
adj[B[i]].pb(A[i]);
}
vector<pair<lli,lli>> range (N);
dfs(0,-1,adj, range);
for (int i = 0; i < N; ++i) {
lli ini=range[i].first;
lli fin=range[i].second;
lli dif=fin-ini;
dif/=2;
Code(i, ini*249999+dif);
}
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define deb(x) ;
using lli=long long int;
void InitDevice()
{
}
static lli base=249999;
int Answer(long long S, long long T)
{
lli difS=S%base;
lli iniS= (S-difS)/base;
lli difT=T%base;
lli iniT=(T-difT)/base;
difS*=2;
difT*=2;
lli finS=iniS+difS;
lli finT=iniT+difT;
if(iniT <= iniS && finS <= finT){
return 0;
}
if(iniS <= iniT && finT <= finS){
return 1;
}
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |