Submission #426676

# Submission time Handle Problem Language Result Execution time Memory
426676 2021-06-14T08:56:12 Z 송준혁(#7530) City (JOI17_city) C++14
8 / 100
191 ms 16196 KB
#include "Encoder.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define MOD 1000000007
#define INF (1ll<<)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

static LL I[303030], num;
static vector<int> adj[303030], C;

static void f(int u, int p){
	I[u] = ++num;
	for (int v : adj[u]){
		if (v == p) continue;
		f(v, u);
	}
	int t=lb(C.begin(), C.end(), num-I[u])-C.begin();
	Code(u, I[u]*C.size()+t);
}

void Encode(int N, int A[], int B[]){
	int t=1;
	C.pb(0);
	while (t<(1ll<<19)){
		C.pb(t);
		t = max((int)(t*1.05), t+1);
	}
	for (int i=0; i<N-1; i++) adj[A[i]].pb(B[i]), adj[B[i]].pb(A[i]);
	f(0, -1);
}
#include "Device.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define MOD 1000000007
#define INF (1ll<<62)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

static vector<int> C;

void InitDevice(){
	int t=1;
	C.pb(0);
	while (t<(1ll<<19)){
		C.pb(t);
		t = max((int)(t*1.05), t+1);
	}
}

int Answer(long long S, long long T){
	int l1 = S/C.size(), r1 = l1 + C[S%C.size()];
	int l2 = T/C.size(), r2 = l2 + C[T%C.size()];
	if (l1 <= l2 && r2 <= r1) return 1;
	if (l2 <= l1 && r1 <= r2) return 0;
	return 2;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7692 KB Output is correct
2 Correct 7 ms 7660 KB Output is correct
3 Correct 6 ms 7680 KB Output is correct
4 Correct 5 ms 7692 KB Output is correct
5 Correct 6 ms 7680 KB Output is correct
6 Correct 7 ms 7748 KB Output is correct
7 Correct 5 ms 7748 KB Output is correct
8 Correct 6 ms 7752 KB Output is correct
9 Correct 6 ms 7680 KB Output is correct
10 Correct 5 ms 7684 KB Output is correct
11 Correct 6 ms 7680 KB Output is correct
12 Correct 7 ms 7680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 191 ms 16196 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -