# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934032 | Saul0906 | City (JOI17_city) | C++14 | 332 ms | 57408 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 <bits/stdc++.h>
#include "Encoder.h"
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define ll long long
#define pb push_back
using namespace std;
const int lim=3e5+5;
ll tim=0, tin[lim], tout[lim];
vector<int> ady[lim];
void dfs(int u, int p){
tin[u]=tim;
repa(v,ady[u]){
if(v!=p) dfs(v,u);
}
tout[u]=tim++;
}
void Encode(int N, int *A, int *B){
rep(i,0,N-1){
ady[A[i]].pb(B[i]);
ady[B[i]].pb(A[i]);
}
dfs(0,-1);
rep(i,0,N){
ll x=tout[i]-tin[i];
x<<=18;
x+=tin[i];
//cout<<i<<" "<<x<<" "<<tin[i]<<" "<<tout[i]<<endl;
Code(i,x);
}
}
#include <bits/stdc++.h>
#include "Device.h"
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define ll long long
using namespace std;
void InitDevice(){
return;
}
const ll md=1<<18;
int Answer(ll S, ll T){
ll a, b, c, d;
a=(S%md);
S>>=18;
b=(S%md);
c=(T%md);
T>>=18;
d=(T%md);
b+=a;
d+=c;
if(a<=c && d<=b) return 1;
if(c<=a && b<=d) return 0;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |