# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699565 |
2023-02-17T12:04:59 Z |
urosk |
City (JOI17_city) |
C++14 |
|
421 ms |
64252 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 1000005
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 1000005
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 1000005
|
Device.cpp:23: note: this is the location of the previous definition
23 | #define maxn 1005
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
32036 KB |
Output is correct |
2 |
Correct |
18 ms |
32040 KB |
Output is correct |
3 |
Correct |
15 ms |
32056 KB |
Output is correct |
4 |
Correct |
17 ms |
31936 KB |
Output is correct |
5 |
Correct |
16 ms |
31900 KB |
Output is correct |
6 |
Correct |
16 ms |
32064 KB |
Output is correct |
7 |
Correct |
15 ms |
31868 KB |
Output is correct |
8 |
Correct |
16 ms |
32088 KB |
Output is correct |
9 |
Correct |
20 ms |
31928 KB |
Output is correct |
10 |
Correct |
18 ms |
32052 KB |
Output is correct |
11 |
Correct |
15 ms |
31928 KB |
Output is correct |
12 |
Correct |
16 ms |
31928 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
162 ms |
40456 KB |
Output is correct - L = 144000721 |
2 |
Correct |
166 ms |
40380 KB |
Output is correct - L = 145000726 |
3 |
Correct |
167 ms |
40504 KB |
Output is correct - L = 145000726 |
4 |
Correct |
178 ms |
40496 KB |
Output is correct - L = 146000731 |
5 |
Correct |
374 ms |
63468 KB |
Output is correct - L = 268001341 |
6 |
Correct |
406 ms |
63548 KB |
Output is correct - L = 268001341 |
7 |
Correct |
421 ms |
63544 KB |
Output is correct - L = 268001341 |
8 |
Partially correct |
386 ms |
63392 KB |
Output is partially correct - L = 272001361 |
9 |
Incorrect |
343 ms |
64252 KB |
Wrong Answer [6] |
10 |
Halted |
0 ms |
0 KB |
- |