#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
const int maxN = 250002;
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 * l[i] * maxN + r[i]);
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
const int maxN = 250002;
void InitDevice()
{
}
int Answer (long long S, long long T)
{
long long lS = S / maxN, rS = S % maxN;
long long lT = T / maxN, rT = T % maxN;
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 |
9 ms |
12288 KB |
Output is correct |
3 |
Correct |
7 ms |
12288 KB |
Output is correct |
4 |
Correct |
8 ms |
12288 KB |
Output is correct |
5 |
Correct |
8 ms |
12288 KB |
Output is correct |
6 |
Correct |
7 ms |
12288 KB |
Output is correct |
7 |
Correct |
8 ms |
12544 KB |
Output is correct |
8 |
Correct |
9 ms |
12544 KB |
Output is correct |
9 |
Correct |
8 ms |
12288 KB |
Output is correct |
10 |
Correct |
8 ms |
12544 KB |
Output is correct |
11 |
Correct |
9 ms |
12288 KB |
Output is correct |
12 |
Correct |
9 ms |
12288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
171 ms |
19616 KB |
Output is partially correct - L = 525006300 |
2 |
Partially correct |
169 ms |
19568 KB |
Output is partially correct - L = 524256291 |
3 |
Partially correct |
201 ms |
19520 KB |
Output is partially correct - L = 525006300 |
4 |
Partially correct |
170 ms |
19344 KB |
Output is partially correct - L = 525006300 |
5 |
Partially correct |
551 ms |
55184 KB |
Output is partially correct - L = 187502250000 |
6 |
Incorrect |
584 ms |
55280 KB |
Wrong Answer [6] |
7 |
Halted |
0 ms |
0 KB |
- |