# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699568 |
2023-02-17T12:07:50 Z |
urosk |
City (JOI17_city) |
C++14 |
|
395 ms |
61544 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 700005
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 maxx 1005
#define maxn 700005
ll len[maxx];
void InitDevice()
{
double cur = 1.0,w =1.05;
len[0] = cur;
for(ll i = 1;i<maxx;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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
17072 KB |
Output is correct |
2 |
Correct |
8 ms |
17068 KB |
Output is correct |
3 |
Correct |
8 ms |
17112 KB |
Output is correct |
4 |
Correct |
9 ms |
17004 KB |
Output is correct |
5 |
Correct |
8 ms |
17072 KB |
Output is correct |
6 |
Correct |
8 ms |
17076 KB |
Output is correct |
7 |
Correct |
9 ms |
17064 KB |
Output is correct |
8 |
Correct |
8 ms |
17072 KB |
Output is correct |
9 |
Correct |
8 ms |
17116 KB |
Output is correct |
10 |
Correct |
9 ms |
17072 KB |
Output is correct |
11 |
Correct |
8 ms |
17064 KB |
Output is correct |
12 |
Correct |
8 ms |
17104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
155 ms |
25552 KB |
Output is correct - L = 100800721 |
2 |
Correct |
155 ms |
25672 KB |
Output is correct - L = 101500726 |
3 |
Correct |
159 ms |
25572 KB |
Output is correct - L = 101500726 |
4 |
Correct |
162 ms |
25604 KB |
Output is correct - L = 102200731 |
5 |
Correct |
364 ms |
48664 KB |
Output is correct - L = 187601341 |
6 |
Correct |
374 ms |
48804 KB |
Output is correct - L = 187601341 |
7 |
Correct |
365 ms |
48600 KB |
Output is correct - L = 187601341 |
8 |
Correct |
369 ms |
48340 KB |
Output is correct - L = 190401361 |
9 |
Correct |
313 ms |
49452 KB |
Output is correct - L = 198801421 |
10 |
Correct |
312 ms |
49268 KB |
Output is correct - L = 200201431 |
11 |
Correct |
312 ms |
49472 KB |
Output is correct - L = 200201431 |
12 |
Correct |
307 ms |
49348 KB |
Output is correct - L = 200201431 |
13 |
Correct |
343 ms |
49048 KB |
Output is correct - L = 193201381 |
14 |
Correct |
362 ms |
48972 KB |
Output is correct - L = 190401361 |
15 |
Correct |
158 ms |
25628 KB |
Output is correct - L = 102200731 |
16 |
Correct |
158 ms |
25580 KB |
Output is correct - L = 100800721 |
17 |
Correct |
160 ms |
25676 KB |
Output is correct - L = 100800721 |
18 |
Correct |
345 ms |
48956 KB |
Output is correct - L = 196001401 |
19 |
Correct |
370 ms |
48984 KB |
Output is correct - L = 196001401 |
20 |
Correct |
344 ms |
48800 KB |
Output is correct - L = 196001401 |
21 |
Correct |
343 ms |
48848 KB |
Output is correct - L = 196701406 |
22 |
Correct |
376 ms |
61400 KB |
Output is correct - L = 193901386 |
23 |
Correct |
364 ms |
61300 KB |
Output is correct - L = 193901386 |
24 |
Correct |
371 ms |
61288 KB |
Output is correct - L = 192501376 |
25 |
Correct |
395 ms |
61164 KB |
Output is correct - L = 191801371 |
26 |
Correct |
383 ms |
61236 KB |
Output is correct - L = 191101366 |
27 |
Correct |
384 ms |
61544 KB |
Output is correct - L = 189001351 |