Submission #699561

# Submission time Handle Problem Language Result Execution time Memory
699561 2023-02-17T12:01:28 Z urosk City (JOI17_city) C++14
8 / 100
392 ms 57364 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 400005
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 400005
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 400005
      | 
Device.cpp:23: note: this is the location of the previous definition
   23 | #define maxn 1005
      |
# Verdict Execution time Memory Grader output
1 Correct 8 ms 13224 KB Output is correct
2 Correct 8 ms 13236 KB Output is correct
3 Correct 8 ms 13212 KB Output is correct
4 Correct 9 ms 13240 KB Output is correct
5 Correct 7 ms 13220 KB Output is correct
6 Correct 7 ms 13196 KB Output is correct
7 Correct 7 ms 13240 KB Output is correct
8 Correct 7 ms 13216 KB Output is correct
9 Correct 7 ms 13196 KB Output is correct
10 Correct 7 ms 13172 KB Output is correct
11 Correct 7 ms 13224 KB Output is correct
12 Correct 7 ms 13252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 176 ms 28656 KB Output is correct - L = 57600721
2 Correct 206 ms 28452 KB Output is correct - L = 58000726
3 Correct 161 ms 28600 KB Output is correct - L = 58000726
4 Correct 164 ms 28584 KB Output is correct - L = 58400731
5 Incorrect 392 ms 57364 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -