# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
53820 |
2018-07-01T08:54:12 Z |
grumpy_gordon |
City (JOI17_city) |
C++17 |
|
205 ms |
17700 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "Encoder.h"
const int maxn = 2e5 + 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)pow(w, val) < t - tin)
val++;
t = tin + (int)pow(w, val);
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 = 2e5 + 10;
const double w = 1.05;
void InitDevice(){
}
int Answer(long long S, long long T)
{
int a = S / maxn, b = S % maxn, c = T / maxn, d = T % maxn;
a = b + (int)pow(w, a) - 1;
c = d + (int)pow(w, c) - 1;
if (a >= c && b <= d)
return 1;
if (a <= c && b >= d)
return 0;
return 2;
}
Compilation message
Encoder.cpp: In function 'void dfs(int, int)':
Encoder.cpp:18:12: warning: unused variable 'kek' [-Wunused-variable]
double kek = 1;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
10328 KB |
Output is correct |
2 |
Correct |
7 ms |
9984 KB |
Output is correct |
3 |
Correct |
7 ms |
9984 KB |
Output is correct |
4 |
Correct |
7 ms |
9984 KB |
Output is correct |
5 |
Correct |
8 ms |
9984 KB |
Output is correct |
6 |
Correct |
8 ms |
9984 KB |
Output is correct |
7 |
Correct |
7 ms |
9984 KB |
Output is correct |
8 |
Correct |
8 ms |
10184 KB |
Output is correct |
9 |
Correct |
8 ms |
9984 KB |
Output is correct |
10 |
Correct |
8 ms |
10240 KB |
Output is correct |
11 |
Correct |
7 ms |
9984 KB |
Output is correct |
12 |
Correct |
7 ms |
9984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
192 ms |
17176 KB |
Output is correct - L = 27201360 |
2 |
Correct |
205 ms |
17136 KB |
Output is correct - L = 27401370 |
3 |
Correct |
189 ms |
17016 KB |
Output is correct - L = 27201360 |
4 |
Correct |
190 ms |
17048 KB |
Output is correct - L = 27401370 |
5 |
Runtime error |
74 ms |
17700 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Halted |
0 ms |
0 KB |
- |