# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
61112 |
2018-07-25T08:15:54 Z |
노영훈(#1760) |
City (JOI17_city) |
C++11 |
|
546 ms |
56888 KB |
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX=250010;
vector<int> G[MX];
int n, nu[MX], ri[MX];
void dfs(int v, int p){
static int now=0;
nu[v]=++now, ri[v]=nu[v];
for(int x:G[v]){
if(x==p) continue;
dfs(x,v);
ri[v]=max(ri[v], ri[x]);
}
}
void Encode(int N, int A[], int B[]){
n=N;
for(int i=0; i<n-1; i++){
int u=A[i], v=B[i];
G[u].push_back(v);
G[v].push_back(u);
}
dfs(0,-1);
for(int i=0; i<n; i++){
// cout<<nu[i]<<' '<<ri[i]<<'\n';
ll now=(ll(nu[i])<<18LL)+ri[i];
Code(i, now);
}
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void InitDevice(){
}
int Answer(long long S, long long T){
int u=S/(1<<18), ru=S%(1<<18);
int v=T/(1<<18), rv=T%(1<<18);
// cout<<u<<' '<<v<<' '<<'\n';
if(u<=v && v<=ru) return 1;
if(v<=u && u<=rv) return 0;
return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
12288 KB |
Output is correct |
2 |
Correct |
9 ms |
12544 KB |
Output is correct |
3 |
Correct |
9 ms |
12544 KB |
Output is correct |
4 |
Correct |
9 ms |
12288 KB |
Output is correct |
5 |
Correct |
9 ms |
12288 KB |
Output is correct |
6 |
Correct |
9 ms |
12544 KB |
Output is correct |
7 |
Correct |
9 ms |
12288 KB |
Output is correct |
8 |
Correct |
8 ms |
12544 KB |
Output is correct |
9 |
Correct |
9 ms |
12544 KB |
Output is correct |
10 |
Correct |
9 ms |
12288 KB |
Output is correct |
11 |
Correct |
9 ms |
12288 KB |
Output is correct |
12 |
Correct |
8 ms |
12288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
169 ms |
19440 KB |
Output is correct - L = 183501500 |
2 |
Correct |
170 ms |
19688 KB |
Output is correct - L = 183239355 |
3 |
Correct |
168 ms |
19528 KB |
Output is correct - L = 183501500 |
4 |
Correct |
170 ms |
19560 KB |
Output is correct - L = 183501500 |
5 |
Partially correct |
505 ms |
55352 KB |
Output is partially correct - L = 65536250000 |
6 |
Partially correct |
489 ms |
55280 KB |
Output is partially correct - L = 65536250000 |
7 |
Partially correct |
499 ms |
55584 KB |
Output is partially correct - L = 65536250000 |
8 |
Partially correct |
500 ms |
54704 KB |
Output is partially correct - L = 65536250000 |
9 |
Partially correct |
430 ms |
56376 KB |
Output is partially correct - L = 65536250000 |
10 |
Partially correct |
417 ms |
56584 KB |
Output is partially correct - L = 65536250000 |
11 |
Partially correct |
423 ms |
56888 KB |
Output is partially correct - L = 65536250000 |
12 |
Partially correct |
435 ms |
56528 KB |
Output is partially correct - L = 65536250000 |
13 |
Partially correct |
455 ms |
56024 KB |
Output is partially correct - L = 65536250000 |
14 |
Partially correct |
466 ms |
55680 KB |
Output is partially correct - L = 65536250000 |
15 |
Correct |
171 ms |
19440 KB |
Output is correct - L = 183501500 |
16 |
Correct |
173 ms |
19528 KB |
Output is correct - L = 183501500 |
17 |
Correct |
169 ms |
19616 KB |
Output is correct - L = 183501500 |
18 |
Partially correct |
485 ms |
55712 KB |
Output is partially correct - L = 65536250000 |
19 |
Partially correct |
459 ms |
55784 KB |
Output is partially correct - L = 65536250000 |
20 |
Partially correct |
475 ms |
55744 KB |
Output is partially correct - L = 65536250000 |
21 |
Partially correct |
455 ms |
55656 KB |
Output is partially correct - L = 65536250000 |
22 |
Partially correct |
466 ms |
55536 KB |
Output is partially correct - L = 65536250000 |
23 |
Partially correct |
477 ms |
55528 KB |
Output is partially correct - L = 65536250000 |
24 |
Partially correct |
483 ms |
55464 KB |
Output is partially correct - L = 65536250000 |
25 |
Partially correct |
546 ms |
55384 KB |
Output is partially correct - L = 65536250000 |
26 |
Partially correct |
490 ms |
55384 KB |
Output is partially correct - L = 65536250000 |
27 |
Partially correct |
502 ms |
55024 KB |
Output is partially correct - L = 65536250000 |