#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
int nr = 0, l[250009], r[250009];
vector < int > v[250009];
void dfs (int nod, int tata)
{
l[nod] = ++nr;
for (auto it : v[nod])
if (it != tata)
dfs (it, nod);
r[nod] = nr;
}
void Encode (int N, int A[], int B[])
{
for (int i=0; i<N; i++)
v[A[i]].push_back (B[i]),
v[B[i]].push_back (A[i]);
dfs (0, -1);
for (int i=0; i<N; i++)
Code(i, ((1LL << 18) * l[i]) | ((long long) r[i]));
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
void InitDevice()
{
}
int Answer (long long S, long long T)
{
long long lS = (S >> 18), rS = S & ((1 << 18LL) - 1);
long long lT = (T >> 18), rT = T & ((1 << 18LL) - 1);
if (lT <= lS && rS <= rT) return 0;
if (lS <= lT && rT <= rS) return 1;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
12544 KB |
Output is correct |
2 |
Correct |
8 ms |
12288 KB |
Output is correct |
3 |
Correct |
8 ms |
12288 KB |
Output is correct |
4 |
Correct |
8 ms |
12288 KB |
Output is correct |
5 |
Correct |
7 ms |
12288 KB |
Output is correct |
6 |
Correct |
8 ms |
12544 KB |
Output is correct |
7 |
Correct |
9 ms |
12288 KB |
Output is correct |
8 |
Correct |
8 ms |
12288 KB |
Output is correct |
9 |
Correct |
8 ms |
12288 KB |
Output is correct |
10 |
Correct |
9 ms |
12544 KB |
Output is correct |
11 |
Correct |
8 ms |
12288 KB |
Output is correct |
12 |
Correct |
8 ms |
12288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
166 ms |
19672 KB |
Output is partially correct - L = 550504500 |
2 |
Partially correct |
167 ms |
19424 KB |
Output is partially correct - L = 549718065 |
3 |
Partially correct |
168 ms |
19384 KB |
Output is partially correct - L = 550504500 |
4 |
Partially correct |
167 ms |
19464 KB |
Output is partially correct - L = 550504500 |
5 |
Incorrect |
557 ms |
55392 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |