# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
225948 | balbit | City (JOI17_city) | C++14 | 529 ms | 73328 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 ll long long
#define pii pair<int,int>
#define f first
#define s second
#define SZ(x) (int)(x.size())
#define ALL(x) x.begin(),x.end()
#define pb push_back
#ifdef BALBIT
#define bug(...) cerr<<__LINE__<<": "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__)
template<typename T> void _do(T && x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S&&...y){cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0),cin.tie(0)
#define endl '\n'
#define bug(...)
#endif // BALBIT
const int maxn = 3e5+5;
vector<int> g[maxn];
ll ord[maxn];
int it = 0;
static ll nm = 250000;
void dfs(int v, int p) {
ord[v] = it++;
for (int u : g[v]) {
if (u != p) {
dfs(u,v);
}
}
Code(v, nm*(ll)ord[v] + it-1);
}
void Encode(int N, int A[], int B[])
{
// n=N;
for (int i = 0; i < N-1; ++i) {
g[A[i]].pb(B[i]);
g[B[i]].pb(A[i]);
}
dfs(0,-1);
}
#ifdef BALBIT
signed main(){
bug(1,2,3);
}
#endif
#include "Device.h"
#define ll long long
static int nm = 250000;
void InitDevice()
{
}
int Answer(long long S, long long T)
{
ll sin = S/nm, sout = S%nm;
ll tin = T/nm, tout = T%nm;
if (sin <= tin && sout >= tout) return 1;
if (tin <= sin && tout >= sout) return 0;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |