# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080324 | kwongweng | City (JOI17_city) | C++17 | 108 ms | 22552 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;
typedef vector<int> vi;
typedef long long ll;
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=a; i>=b; i--)
#define pb push_back
const int N = 2e5;
vi g[N], p(N), sz(N), tin(N);
int cnt = 0;
void dfs(int u){
tin[u] = cnt++; sz[u]=1;
for (int v : g[u]){
if (p[u]==v) continue;
p[v]=u; dfs(v); sz[u] += sz[v];
}
Code(u,(ll)tin[u]*(ll)N + (ll)sz[u]);
}
void Encode(int n, int A[], int B[])
{
FOR(i,0,n-1){
g[A[i]].pb(B[i]); g[B[i]].pb(A[i]);
}
dfs(0);
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=a; i>=b; i--)
#define pb push_back
const int N = 2e5;
void InitDevice()
{
}
int Answer(long long S, long long T)
{
//cout<<S/N<<" "<<S%N<<" "<<T/N<<" "<<T%N<<"\n";
if (S<T){
if (T/N < S/N + S%N) return 1;
return 2;
}
if (S/N < T/N + T%N) return 0;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |