Submission #49422

# Submission time Handle Problem Language Result Execution time Memory
49422 2018-05-28T16:15:22 Z SpaimaCarpatilor City (JOI17_city) C++17
22 / 100
558 ms 56824 KB
#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 - 1; 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 12288 KB Output is correct
2 Correct 9 ms 12544 KB Output is correct
3 Correct 8 ms 12288 KB Output is correct
4 Correct 8 ms 12288 KB Output is correct
5 Correct 9 ms 12288 KB Output is correct
6 Correct 8 ms 12544 KB Output is correct
7 Correct 8 ms 12288 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 8 ms 12544 KB Output is correct
12 Correct 9 ms 12288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 165 ms 19440 KB Output is correct - L = 175002100
2 Correct 166 ms 19480 KB Output is correct - L = 174752097
3 Correct 170 ms 19480 KB Output is correct - L = 175002100
4 Correct 165 ms 19632 KB Output is correct - L = 175002100
5 Partially correct 481 ms 55336 KB Output is partially correct - L = 62500750000
6 Partially correct 494 ms 55224 KB Output is partially correct - L = 62500750000
7 Partially correct 504 ms 55360 KB Output is partially correct - L = 62500750000
8 Partially correct 517 ms 54736 KB Output is partially correct - L = 62500750000
9 Partially correct 430 ms 56728 KB Output is partially correct - L = 62500750000
10 Partially correct 425 ms 56824 KB Output is partially correct - L = 62500750000
11 Partially correct 413 ms 56680 KB Output is partially correct - L = 62500750000
12 Partially correct 398 ms 56536 KB Output is partially correct - L = 62500750000
13 Partially correct 439 ms 56032 KB Output is partially correct - L = 62500750000
14 Partially correct 475 ms 55624 KB Output is partially correct - L = 62500750000
15 Correct 166 ms 19728 KB Output is correct - L = 175002100
16 Correct 167 ms 19440 KB Output is correct - L = 175002100
17 Correct 172 ms 19440 KB Output is correct - L = 175002100
18 Partially correct 457 ms 55600 KB Output is partially correct - L = 62500750000
19 Partially correct 486 ms 55712 KB Output is partially correct - L = 62500750000
20 Partially correct 459 ms 55696 KB Output is partially correct - L = 62500750000
21 Partially correct 482 ms 55592 KB Output is partially correct - L = 62500750000
22 Partially correct 493 ms 55448 KB Output is partially correct - L = 62500750000
23 Partially correct 491 ms 55720 KB Output is partially correct - L = 62500750000
24 Partially correct 500 ms 55256 KB Output is partially correct - L = 62500750000
25 Partially correct 504 ms 55472 KB Output is partially correct - L = 62500750000
26 Partially correct 558 ms 55160 KB Output is partially correct - L = 62500750000
27 Partially correct 484 ms 55152 KB Output is partially correct - L = 62500750000