QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#859437#9678. 网友小 Z 的树skip2004Compile Error//C++201.8kb2025-01-17 19:04:592025-01-17 19:05:00

Judging History

你现在查看的是测评时间为 2025-01-17 19:05:00 的历史记录

  • [2025-01-17 19:20:14]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:571ms
  • 内存:60028kb
  • [2025-01-17 19:17:35]
  • 管理员手动重测本题所有提交记录
  • [2025-01-17 19:13:51]
  • 管理员手动重测本题所有提交记录
  • [2025-01-17 19:05:00]
  • 评测
  • [2025-01-17 19:04:59]
  • 提交

answer

#include "diameter.h"
#include<bits/stdc++.h>
#define For(i,x,y) for (int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (int i=(x);i<(y);i++)
#define Dow(i,x,y) for (int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define fil(a,b) memset(a,b,sizeof a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;

const int N = 1e5+10;
int a[N],n;
pa find_diameter(int subid,int n){
	assert(n<=100000);
	if (n==1) return mp(1,1);
	if (n==2) return mp(1,2);
	if (n==3){
		if (in(1,2,3)) return mp(2,3);
		if (in(2,1,3)) return mp(1,3);
		return mp(1,2);
	}
	int x=1,y=2,z=0,t=0;
	{
		int mx=0;
		For(i,1,n) if (i!=x&&i!=y){
			a[i]=query(x,y,i);
			if (!mx) mx=i;
			else if (a[i]>a[mx]) mx=i;
		}
		y=mx;
	}
	{
		int mx=0;
		For(i,1,n) if (i!=x&&i!=y){
			a[i]=query(x,y,i);
			if (!mx) mx=i;
			else if (a[i]>a[mx]) mx=i;
		}
		z=mx;
	}
	{
		int mx=0,mn=0;
		For(i,1,n) if (i!=y&&i!=z){
			a[i]=query(y,z,i);
			if (!mx) mx=mn=i;
			else {
				if (a[i]>a[mx]) mx=i;
				if (a[i]<a[mn]) mn=i;
			}
		}
		x=mx,t=mn;
	}
	if (t==x) return mp(y,z);
	if (!in(t,y,z)){
		if (query(x,t,y)<query(x,t,z)) return mp(x,z);
		return mp(x,y);
	}
	int disxyz=a[x]/2;
	int disyz=a[t]/2;
	int disx_=disxyz-disyz;
	int disyxt=query(y,x,t)/2;
	int diszxt=query(x,t,z)/2;
	int dist_=disyxt+diszxt-disx_-disxyz;
	int disyx,diszx;
	if (!in(t,y,x)){
		disyx=disyxt-dist_;
		diszx=diszxt;
	} else {
		disyx=disyxt;
		diszx=diszxt-dist_;
	}
	if (max({disyx,disyz,diszx})==disyx) return mp(x,y);
	if (max({disyx,disyz,diszx})==disyz) return mp(y,z);
	return mp(x,z);
}

Details

cc1plus: fatal error: implementer.cpp: No such file or directory
compilation terminated.