# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
925342 |
2024-02-11T13:11:51 Z |
bachhoangxuan |
City (JOI17_city) |
C++17 |
|
277 ms |
53048 KB |
#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
const int N=500000;
namespace{
const int maxn = 250005;
vector<int> edge[maxn];
int pos=0,L[maxn];
}
void Encode(int n, int A[], int B[])
{
for(int i=0;i<n-1;i++){
edge[A[i]].push_back(B[i]);
edge[B[i]].push_back(A[i]);
}
function<void(int,int)> dfs = [&](int u,int p){
L[u]=pos++;
for(int v:edge[u]) if(v!=p) dfs(v,u);
double cur=1.0,w=1.05;
int num=0;
while(L[u]+(int)cur<pos) cur*=w,num++;
pos=L[u]+(int)cur;
Code(u,1LL*num*N+L[u]);
};
dfs(0,0);
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
const int N=500000;
namespace{
double w=1.05;
double d[2025];
}
void InitDevice()
{
d[0]=1;
for(int i=1;i<=2000;i++) d[i]=d[i-1]*w;
}
int Answer(long long S, long long T)
{
int ls=S%N,rs=ls+(int)d[S/N];
int lt=T%N,rt=lt+(int)d[T/N];
if(ls<=lt && rt<=rs) return 1;
if(lt<=ls && rs<=rt) return 0;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
13076 KB |
Output is correct |
2 |
Correct |
3 ms |
13088 KB |
Output is correct |
3 |
Correct |
3 ms |
13488 KB |
Output is correct |
4 |
Correct |
2 ms |
13072 KB |
Output is correct |
5 |
Correct |
2 ms |
13088 KB |
Output is correct |
6 |
Correct |
2 ms |
13080 KB |
Output is correct |
7 |
Correct |
3 ms |
13088 KB |
Output is correct |
8 |
Correct |
2 ms |
13072 KB |
Output is correct |
9 |
Correct |
3 ms |
13072 KB |
Output is correct |
10 |
Correct |
3 ms |
13088 KB |
Output is correct |
11 |
Correct |
3 ms |
13088 KB |
Output is correct |
12 |
Correct |
2 ms |
13076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
27876 KB |
Output is correct - L = 68000000 |
2 |
Correct |
128 ms |
27604 KB |
Output is correct - L = 68500000 |
3 |
Correct |
129 ms |
27856 KB |
Output is correct - L = 68000000 |
4 |
Correct |
120 ms |
27644 KB |
Output is correct - L = 68500000 |
5 |
Correct |
271 ms |
51696 KB |
Output is correct - L = 129500000 |
6 |
Correct |
270 ms |
51680 KB |
Output is correct - L = 130000000 |
7 |
Correct |
277 ms |
51780 KB |
Output is correct - L = 130000000 |
8 |
Correct |
275 ms |
51432 KB |
Output is correct - L = 131500000 |
9 |
Correct |
255 ms |
53048 KB |
Output is correct - L = 135000000 |
10 |
Correct |
230 ms |
52376 KB |
Output is correct - L = 136000000 |
11 |
Correct |
230 ms |
52524 KB |
Output is correct - L = 136000000 |
12 |
Correct |
229 ms |
52468 KB |
Output is correct - L = 136000000 |
13 |
Correct |
246 ms |
52212 KB |
Output is correct - L = 132500000 |
14 |
Correct |
253 ms |
51628 KB |
Output is correct - L = 130500000 |
15 |
Correct |
120 ms |
27688 KB |
Output is correct - L = 68000000 |
16 |
Correct |
125 ms |
27516 KB |
Output is correct - L = 68000000 |
17 |
Correct |
120 ms |
27664 KB |
Output is correct - L = 68000000 |
18 |
Correct |
265 ms |
51736 KB |
Output is correct - L = 135500000 |
19 |
Correct |
252 ms |
51736 KB |
Output is correct - L = 135500000 |
20 |
Correct |
260 ms |
51660 KB |
Output is correct - L = 135500000 |
21 |
Correct |
255 ms |
51736 KB |
Output is correct - L = 135000000 |
22 |
Correct |
259 ms |
51680 KB |
Output is correct - L = 135500000 |
23 |
Correct |
255 ms |
51680 KB |
Output is correct - L = 135500000 |
24 |
Correct |
261 ms |
51928 KB |
Output is correct - L = 135000000 |
25 |
Correct |
267 ms |
51508 KB |
Output is correct - L = 134500000 |
26 |
Correct |
270 ms |
51852 KB |
Output is correct - L = 134000000 |
27 |
Correct |
270 ms |
51676 KB |
Output is correct - L = 133000000 |