Submission #699562

# Submission time Handle Problem Language Result Execution time Memory
699562 2023-02-17T12:02:55 Z urosk City (JOI17_city) C++14
8 / 100
396 ms 64484 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 600005
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 600005
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 600005
      | 
Device.cpp:23: note: this is the location of the previous definition
   23 | #define maxn 1005
      |
# Verdict Execution time Memory Grader output
1 Correct 10 ms 19360 KB Output is correct
2 Correct 12 ms 19356 KB Output is correct
3 Correct 9 ms 19484 KB Output is correct
4 Correct 9 ms 19360 KB Output is correct
5 Correct 10 ms 19368 KB Output is correct
6 Correct 10 ms 19360 KB Output is correct
7 Correct 10 ms 19364 KB Output is correct
8 Correct 10 ms 19368 KB Output is correct
9 Correct 10 ms 19360 KB Output is correct
10 Correct 9 ms 19436 KB Output is correct
11 Correct 12 ms 19360 KB Output is correct
12 Correct 11 ms 19360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 158 ms 27920 KB Output is correct - L = 86400721
2 Correct 156 ms 27876 KB Output is correct - L = 87000726
3 Correct 167 ms 27968 KB Output is correct - L = 87000726
4 Correct 159 ms 28012 KB Output is correct - L = 87600731
5 Correct 387 ms 51032 KB Output is correct - L = 160801341
6 Correct 384 ms 63528 KB Output is correct - L = 160801341
7 Correct 396 ms 63560 KB Output is correct - L = 160801341
8 Correct 384 ms 63196 KB Output is correct - L = 163201361
9 Correct 325 ms 64208 KB Output is correct - L = 170401421
10 Correct 313 ms 64232 KB Output is correct - L = 171601431
11 Correct 306 ms 64128 KB Output is correct - L = 171601431
12 Correct 315 ms 64484 KB Output is correct - L = 171601431
13 Incorrect 357 ms 63856 KB Wrong Answer [6]
14 Halted 0 ms 0 KB -