# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699563 |
2023-02-17T12:03:40 Z |
urosk |
City (JOI17_city) |
C++14 |
|
390 ms |
70148 KB |
#include "Encoder.h"
#include "bits/stdc++.h"
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#define ld double
#define ll int
#define llinf 100000000000000000LL // 10^17
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) (ll)(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}
#define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);
using namespace std;
#define maxn 800005
ll n;
vector<ll> g[maxn];
ll in[maxn],ti = 0;
void dfs(ll u,ll p){
in[u] = ++ti;
for(ll s : g[u]) if(s^p) dfs(s,u);
double cur = 1.0,w = 1.05;
ll ans = 0;
while((ll)cur<ti-in[u]) cur*=w,ans++;
ti = in[u] + (ll)(cur);
Code(u,maxn*ans+in[u]);
}
void Encode(int N, int A[], int B[])
{
n = N;
for(ll i = 0;i<n-1;i++){
ll x = A[i],y = B[i];
g[x].pb(y);
g[y].pb(x);
}
dfs(0,0);
}
#include "Device.h"
#include "bits/stdc++.h"
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#define ld double
#define ll long long
#define llinf 100000000000000000LL // 10^17
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) (ll)(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}
#define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);
using namespace std;
#define maxn 1005
#define maxn 800005
ll len[maxn];
void InitDevice()
{
double cur = 1.0,w =1.05;
len[0] = cur;
for(ll i = 1;i<maxn;i++){
cur*=w;
len[i] = (ll)(cur);
}
}
int Answer(ll u,ll v)
{
ll inu = u%maxn,inv = v%maxn;
ll outu = inu + len[u/maxn],outv = inv + len[v/maxn];
if(inv>=inu&&outu>=outv) return 1;
if(inv<=inu&&outu<=outv) return 0;
return 2;
}
Compilation message
Device.cpp:24: warning: "maxn" redefined
24 | #define maxn 800005
|
Device.cpp:23: note: this is the location of the previous definition
23 | #define maxn 1005
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
25636 KB |
Output is correct |
2 |
Correct |
13 ms |
25640 KB |
Output is correct |
3 |
Correct |
14 ms |
25652 KB |
Output is correct |
4 |
Correct |
14 ms |
25644 KB |
Output is correct |
5 |
Correct |
12 ms |
25652 KB |
Output is correct |
6 |
Correct |
13 ms |
25628 KB |
Output is correct |
7 |
Correct |
14 ms |
25824 KB |
Output is correct |
8 |
Correct |
16 ms |
25636 KB |
Output is correct |
9 |
Correct |
13 ms |
25716 KB |
Output is correct |
10 |
Correct |
13 ms |
25724 KB |
Output is correct |
11 |
Correct |
13 ms |
25676 KB |
Output is correct |
12 |
Correct |
13 ms |
25648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
166 ms |
34188 KB |
Output is correct - L = 115200721 |
2 |
Correct |
161 ms |
34060 KB |
Output is correct - L = 116000726 |
3 |
Correct |
158 ms |
34144 KB |
Output is correct - L = 116000726 |
4 |
Correct |
159 ms |
34160 KB |
Output is correct - L = 116800731 |
5 |
Correct |
368 ms |
57184 KB |
Output is correct - L = 214401341 |
6 |
Correct |
369 ms |
57448 KB |
Output is correct - L = 214401341 |
7 |
Correct |
376 ms |
57288 KB |
Output is correct - L = 214401341 |
8 |
Correct |
390 ms |
57052 KB |
Output is correct - L = 217601361 |
9 |
Correct |
316 ms |
57972 KB |
Output is correct - L = 227201421 |
10 |
Correct |
323 ms |
57956 KB |
Output is correct - L = 228801431 |
11 |
Correct |
308 ms |
58112 KB |
Output is correct - L = 228801431 |
12 |
Correct |
303 ms |
57948 KB |
Output is correct - L = 228801431 |
13 |
Correct |
343 ms |
57776 KB |
Output is correct - L = 220801381 |
14 |
Correct |
370 ms |
69944 KB |
Output is correct - L = 217601361 |
15 |
Correct |
164 ms |
41268 KB |
Output is correct - L = 116800731 |
16 |
Correct |
162 ms |
41036 KB |
Output is correct - L = 115200721 |
17 |
Correct |
163 ms |
41104 KB |
Output is correct - L = 115200721 |
18 |
Correct |
355 ms |
69916 KB |
Output is correct - L = 224001401 |
19 |
Correct |
350 ms |
70036 KB |
Output is correct - L = 224001401 |
20 |
Correct |
352 ms |
69996 KB |
Output is correct - L = 224001401 |
21 |
Incorrect |
356 ms |
70148 KB |
Wrong Answer [6] |
22 |
Halted |
0 ms |
0 KB |
- |