# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
26898 |
2017-07-07T03:50:55 Z |
wangyenjen |
City (JOI17_city) |
C++14 |
|
542 ms |
56576 KB |
/// Author: Wang, Yen-Jen
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int MAX_N = 250000 + 7;
static int dfs_clock;
static vector<int> G[MAX_N];
static int lb[MAX_N] , rb[MAX_N];
static int dfs(int u , int fa) {
lb[u] = rb[u] = ++dfs_clock;
for(int v : G[u]) {
if(v != fa) rb[u] = max(rb[u] , dfs(v , u));
}
return rb[u];
}
void Encode(int N , int A[] , int B[]) {
for(int i = 0; i < N; i++) G[i].clear();
for(int i = 0; i < N - 1; i++) {
G[A[i]].push_back(B[i]);
G[B[i]].push_back(A[i]);
}
dfs_clock = 0;
dfs(0 , -1);
for(int i = 0; i < N; i++) Code(i , (ll)lb[i]<<18|rb[i]);
}
/// Author: Wang, Yen-Jen
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
void InitDevice() {
}
int Answer(long long S , long long T) {
int sl = S>>18;
int sr = S&((1<<18)-1);
int tl = T>>18;
int tr = T&((1<<18)-1);
if(tl <= sl && sr <= tr) return 0;
else if(sl <= tl && tr <= sr) return 1;
else return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
12288 KB |
Output is correct |
2 |
Correct |
7 ms |
12488 KB |
Output is correct |
3 |
Correct |
9 ms |
12288 KB |
Output is correct |
4 |
Correct |
9 ms |
12288 KB |
Output is correct |
5 |
Correct |
8 ms |
12288 KB |
Output is correct |
6 |
Correct |
9 ms |
12288 KB |
Output is correct |
7 |
Correct |
9 ms |
12544 KB |
Output is correct |
8 |
Correct |
27 ms |
12544 KB |
Output is correct |
9 |
Correct |
9 ms |
12504 KB |
Output is correct |
10 |
Correct |
9 ms |
12544 KB |
Output is correct |
11 |
Correct |
9 ms |
12544 KB |
Output is correct |
12 |
Correct |
9 ms |
12288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
172 ms |
19440 KB |
Output is correct - L = 183501500 |
2 |
Correct |
170 ms |
19552 KB |
Output is correct - L = 183239355 |
3 |
Correct |
169 ms |
19504 KB |
Output is correct - L = 183501500 |
4 |
Correct |
167 ms |
19440 KB |
Output is correct - L = 183501500 |
5 |
Partially correct |
487 ms |
55320 KB |
Output is partially correct - L = 65536250000 |
6 |
Partially correct |
483 ms |
55152 KB |
Output is partially correct - L = 65536250000 |
7 |
Partially correct |
518 ms |
55224 KB |
Output is partially correct - L = 65536250000 |
8 |
Partially correct |
504 ms |
54792 KB |
Output is partially correct - L = 65536250000 |
9 |
Partially correct |
419 ms |
56536 KB |
Output is partially correct - L = 65536250000 |
10 |
Partially correct |
397 ms |
56536 KB |
Output is partially correct - L = 65536250000 |
11 |
Partially correct |
403 ms |
56576 KB |
Output is partially correct - L = 65536250000 |
12 |
Partially correct |
411 ms |
56536 KB |
Output is partially correct - L = 65536250000 |
13 |
Partially correct |
455 ms |
55848 KB |
Output is partially correct - L = 65536250000 |
14 |
Partially correct |
469 ms |
55688 KB |
Output is partially correct - L = 65536250000 |
15 |
Correct |
176 ms |
19592 KB |
Output is correct - L = 183501500 |
16 |
Correct |
166 ms |
19384 KB |
Output is correct - L = 183501500 |
17 |
Correct |
168 ms |
19480 KB |
Output is correct - L = 183501500 |
18 |
Partially correct |
519 ms |
55856 KB |
Output is partially correct - L = 65536250000 |
19 |
Partially correct |
472 ms |
55952 KB |
Output is partially correct - L = 65536250000 |
20 |
Partially correct |
475 ms |
55768 KB |
Output is partially correct - L = 65536250000 |
21 |
Partially correct |
518 ms |
55832 KB |
Output is partially correct - L = 65536250000 |
22 |
Partially correct |
542 ms |
55376 KB |
Output is partially correct - L = 65536250000 |
23 |
Partially correct |
516 ms |
55576 KB |
Output is partially correct - L = 65536250000 |
24 |
Partially correct |
528 ms |
55368 KB |
Output is partially correct - L = 65536250000 |
25 |
Partially correct |
512 ms |
55440 KB |
Output is partially correct - L = 65536250000 |
26 |
Partially correct |
537 ms |
55192 KB |
Output is partially correct - L = 65536250000 |
27 |
Partially correct |
528 ms |
55320 KB |
Output is partially correct - L = 65536250000 |