#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];
int ord[maxn];
int it = 0;
static int 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*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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
14848 KB |
Output is correct |
2 |
Correct |
12 ms |
14848 KB |
Output is correct |
3 |
Correct |
12 ms |
14848 KB |
Output is correct |
4 |
Correct |
12 ms |
14848 KB |
Output is correct |
5 |
Correct |
12 ms |
14848 KB |
Output is correct |
6 |
Correct |
13 ms |
14848 KB |
Output is correct |
7 |
Correct |
12 ms |
14848 KB |
Output is correct |
8 |
Correct |
12 ms |
14848 KB |
Output is correct |
9 |
Correct |
12 ms |
14848 KB |
Output is correct |
10 |
Correct |
12 ms |
14848 KB |
Output is correct |
11 |
Correct |
12 ms |
14848 KB |
Output is correct |
12 |
Correct |
12 ms |
14848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
214 ms |
28944 KB |
Output is correct - L = 174750699 |
2 |
Correct |
215 ms |
28984 KB |
Output is correct - L = 174500698 |
3 |
Correct |
216 ms |
28912 KB |
Output is correct - L = 174750699 |
4 |
Correct |
218 ms |
28912 KB |
Output is correct - L = 174750699 |
5 |
Incorrect |
166 ms |
47600 KB |
Wrong Answer [3] |
6 |
Halted |
0 ms |
0 KB |
- |