| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 116969 | tmwilliamlin168 | City (JOI17_city) | C++14 | 596 ms | 56272 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN=2.5e5, B=1<<8;
vector<int> adj[mxN];
int s[mxN], dt1, dt2;
int encrange(int a, int b) {
	return b*(b-1)/2+a;
}
void dfs2(int u) {
	int ds=dt2++;
	for(int v : adj[u])
		dfs2(v);
	Code(u, 1<<26|dt1<<15|encrange(ds, dt2));
}
void dfs1(int u=0, int p=-1, int d=0) {
	int ds=dt1;
	s[u]=1;
	if(~p)
		adj[u].erase(find(adj[u].begin(), adj[u].end(), p));
	for(int v : adj[u]) {
		dfs1(v, u, d+1);
		s[u]+=s[v];
	}
	if(u&&s[u]<B)
		return;
	sort(adj[u].begin(), adj[u].end(), [](const int &a, const int &b) {
		return s[a]<s[b];
	});
	for(int i=0, cs; i<adj[u].size()&&s[adj[u][i]]<B; ++dt1) {
		dt2=0, cs=0;
		while(i<adj[u].size()&&cs+s[adj[u][i]]<B) {
			cs+=s[adj[u][i]];
			dfs2(adj[u][i++]);
		}
	}
	Code(u, d<<21|encrange(ds, dt1));
}
void Encode(int n, int a[], int b[]) {
	for(int i=0; i<n-1; ++i) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	dfs1();
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
void InitDevice() {}
array<int, 2> decrange(int x) {
	int l=1, r=1<<11;
	while(l<r) {
		int m=(l+r+1)/2;
		if(m*(m-1)/2<=x)
			l=m;
		else
			r=m-1;
	}
	return {x-r*(r-1)/2, r};
}
int Answer(long long s, long long t) {
	if(s>>26&&t>>26) {
		if((s>>15^t>>15)&(1<<11)-1)
			return 2;
		array<int, 2> rs=decrange(s&(1<<15)-1), rt=decrange(t&(1<<15)-1);
		if(rs[0]<=rt[0]&&rt[0]<rs[1])
			return 1;
		if(rt[0]<=rs[0]&&rs[0]<rt[1])
			return 0;
		return 2;
	}
	if(s>>26) {
		int x=s>>15&(1<<11)-1;
		array<int, 2> r=decrange(t&(1<<21)-1);
		return r[0]<=x&&x<r[1]?0:2;
	}
	if(t>>26) {
		int x=t>>15&(1<<11)-1;
		array<int, 2> r=decrange(s&(1<<21)-1);
		return r[0]<=x&&x<r[1]?1:2;
	}
	int sd=s>>21, td=t>>21;
	array<int, 2> rs=decrange(s&(1<<21)-1), rt=decrange(t&(1<<21)-1);
	if(td>sd&&rs[0]<=rt[0]&&rt[0]<rs[1])
		return 1;
	if(sd>td&&rt[0]<=rs[0]&&rs[0]<rt[1])
		return 0;
	return 2;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
