| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 64547 | zadrga | City (JOI17_city) | C++14 | 522 ms | 64016 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxm 1000111
#define maxn 250111
#define maxk 252
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
int first_over[maxm], a[maxk];
int l[maxn], len[maxn], cnt;
vector<int> adj[maxn];
void init(){
	cnt = 0;
	for(int i = 0; i < maxn; i++)
		adj[i].clear();
	a[1] = 1;
	for(int i = 2; i < maxk; i++){
		a[i] = (double) a[i - 1] * 1.05;
		a[i] = max(a[i], a[i - 1] + 1);
	}
	int ind = 1;
	for(int i = 1; i <= a[maxk - 1]; i++){
		while(a[ind] < i)
			ind++;
		first_over[i] = ind;
	}
}
void DFS(int x, int p){
	l[x] = ++cnt;
	for(int v : adj[x]){
		if(v == p)
			continue;
		DFS(v, x);
	}
	int num = first_over[cnt - l[x] + 1];
	cnt = l[x] + a[num] - 1;
	len[x] = num; 
}
void Encode(int N, int A[], int B[]){
	init();
	for(int i = 0; i < N - 1; i++){
		adj[A[i]].pb(B[i]);
		adj[B[i]].pb(A[i]);
	}
	DFS(0, -1);
	for(int i = 0; i < N; i++)
		Code(i, 1LL * len[i] * maxm + l[i]);
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxm 1000111
#define maxn 250111
#define maxk 252
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
int a1[maxk];
void InitDevice(){
	a1[1] = 1;
	for(int i = 2; i < maxk; i++){
		a1[i] = (double) a1[i - 1] * 1.05;
		a1[i] = max(a1[i], a1[i - 1] + 1);
	}
}
void decode(ll x, int &l, int &d){
	l = x % maxm;
	d = l + a1[x / maxm] - 1; 
}
int Answer(long long S, long long T){
	int la, ra; decode(S, la, ra);
	int lb, rb; decode(T, lb, rb);
	if(lb <= la && ra <= rb)
		return 0;
	if(la <= lb && rb <= ra)
		return 1;
	return 2;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
