# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
53839 |
2018-07-01T09:16:21 Z |
grumpy_gordon |
City (JOI17_city) |
C++17 |
|
493 ms |
51352 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "Encoder.h"
const int maxn = 25e4 + 10;
const double w = 1.05;
vector<int> e[maxn];
int t;
void dfs(int v, int par){
int tin = t++;
for (int i : e[v])
if (i != par)
dfs(i, v);
int val = 0;
double kek = 1;
while ((int)kek < t - tin)
val++, kek *= w;
t = tin + (int)kek;
assert(val <= 300);
Code(v, val * (ll)maxn + tin);
}
void Encode(int N, int A[], int B[])
{
int n = N;
for (int i = 0; i < n - 1; i++){
int v = A[i], u = B[i];
e[v].push_back(u);
e[u].push_back(v);
}
dfs(0, -1);
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "Encoder.h"
const int maxn = 25e4 + 10;
const double w = 1.05;
double mas[2000];
void InitDevice(){
mas[0] = 1;
for (int i = 1; i < 2000; i++)
mas[i] = mas[i - 1] * w;
}
int Answer(long long S, long long T)
{
int a = S / maxn, b = S % maxn, c = T / maxn, d = T % maxn;
a = b + (int)mas[a] - 1;
c = d + (int)mas[c] - 1;
if (a >= c && b <= d)
return 1;
if (a <= c && b >= d)
return 0;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
12416 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 |
8 ms |
12288 KB |
Output is correct |
6 |
Correct |
7 ms |
12288 KB |
Output is correct |
7 |
Correct |
8 ms |
12288 KB |
Output is correct |
8 |
Correct |
8 ms |
12288 KB |
Output is correct |
9 |
Correct |
8 ms |
12288 KB |
Output is correct |
10 |
Correct |
9 ms |
12376 KB |
Output is correct |
11 |
Correct |
8 ms |
12288 KB |
Output is correct |
12 |
Correct |
9 ms |
12544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
204 ms |
19400 KB |
Output is correct - L = 34001360 |
2 |
Correct |
178 ms |
19384 KB |
Output is correct - L = 34251370 |
3 |
Correct |
169 ms |
19416 KB |
Output is correct - L = 34001360 |
4 |
Correct |
174 ms |
19456 KB |
Output is correct - L = 34251370 |
5 |
Incorrect |
493 ms |
51352 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |