QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#864558#9678. 网友小 Z 的树KaXdd_#Compile Error//C++141.3kb2025-01-20 18:47:502025-01-20 18:47:50

Judging History

你现在查看的是最新测评结果

  • [2025-01-20 18:47:50]
  • 评测
  • [2025-01-20 18:47:50]
  • 提交

answer

#include"diameter.h"
#include<bits/stdc++.h>
#define int long long
#define L(i, a, b) for (int i = (a); i <= (b); i++)
#define R(i, a, b) for (int i = (a); i >= (b); i--)
using namespace std;

pair<int, int> find_diameter(int subid, int n){
	const int inf = 1e18;
	if (n == 1) return {1, 1};
	if (n == 2) return {1, 2};
	if (n == 3){
		if (in(1, 2, 3)) return {2, 3};
		if (in(2, 1, 3)) return {1, 3};
		return {1, 2};
	}
	int mx = 0, p = 0;
	L(i, 1, n){
		if ((i ^ 1) && (i ^ 2)){
			int ret = query(1, 2, i);
			if (ret > mx){
				mx = ret;
				p = i;
			}
		}
	}
	int x = p;
	mx = p = 0;
	L(i, 1, n){
		if ((i ^ 2) && (i ^ x)){
			int ret = query(2, x, i);
			if (ret > mx){
				mx = ret;
				p = i;
			}
		}
	}
	int y = p;
	mx = p = 0;
	int xy = inf / 2;
	L(i, 1, n){
		if ((i ^ x) && (i ^ y)){
			int ret = query(x, y, i);
			xy = min(xy, ret);
			if (ret > mx){
				mx = ret;
				p = i;
			}
		}
	}
	int xp = inf / 2, py = inf / 2;
	L(i, 1, n){
		if ((i ^ x) && (i ^ p)){
			int ret = query(x, p, i);
			xp = min(xp, ret);
		}
	}
	L(i, 1, n){
		if ((i ^ p) && (i ^ y)){
			int ret = query(p, y, i);
			py = min(py, ret);
		}
	}
	if (xy == min({xy, xp, py})) return {x, y};
	else if (xp = min({xy, xp, py})) return {x, p};
	else return {p, y};
}

Details

/usr/bin/ld: /tmp/cc48c1ov.o: in function `main':
implementer.cpp:(.text.startup+0x3e7): undefined reference to `find_diameter(int, int)'
collect2: error: ld returned 1 exit status