QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864545#9678. 网友小 Z 的树KaXdd_#Compile Error//C++14918b2025-01-20 18:37:442025-01-20 18:37:52

Judging History

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

  • [2025-01-20 18:37:52]
  • 评测
  • [2025-01-20 18:37:44]
  • 提交

answer

#include"diameter.h"
#include<bits/stdc++.h>
#define L(i, a, b) for (rg int i = (a); i <= (b); i++)
#define R(i, a, b) for (rg 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, 3, n){
		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;
	return {x, y};
	mx = p = 0;
	int mn = inf / 2;
	L(i, 1, n){
		if ((i ^ x) && (i ^ y)){
			int ret = query(x, y, i);
			ckmin(mn, ret);
			if (ret > mx){
				mx = ret;
				p = i;
			}
		}
	}
	
}

詳細信息

answer.code: In function ‘std::pair<int, int> find_diameter(int, int)’:
answer.code:8:25: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+18’ to ‘2147483647’ [-Woverflow]
    8 |         const int inf = 1e18;
      |                         ^~~~
answer.code:3:25: error: ‘rg’ was not declared in this scope
    3 | #define L(i, a, b) for (rg int i = (a); i <= (b); i++)
      |                         ^~
answer.code:17:9: note: in expansion of macro ‘L’
   17 |         L(i, 3, n){
      |         ^
answer.code:17:11: error: ‘i’ was not declared in this scope
   17 |         L(i, 3, n){
      |           ^
answer.code:3:41: note: in definition of macro ‘L’
    3 | #define L(i, a, b) for (rg int i = (a); i <= (b); i++)
      |                                         ^
answer.code:3:25: error: ‘rg’ was not declared in this scope
    3 | #define L(i, a, b) for (rg int i = (a); i <= (b); i++)
      |                         ^~
answer.code:26:9: note: in expansion of macro ‘L’
   26 |         L(i, 1, n){
      |         ^
answer.code:26:11: error: ‘i’ was not declared in this scope
   26 |         L(i, 1, n){
      |           ^
answer.code:3:41: note: in definition of macro ‘L’
    3 | #define L(i, a, b) for (rg int i = (a); i <= (b); i++)
      |                                         ^
answer.code:3:25: error: ‘rg’ was not declared in this scope
    3 | #define L(i, a, b) for (rg int i = (a); i <= (b); i++)
      |                         ^~
answer.code:39:9: note: in expansion of macro ‘L’
   39 |         L(i, 1, n){
      |         ^
answer.code:39:11: error: ‘i’ was not declared in this scope
   39 |         L(i, 1, n){
      |           ^
answer.code:3:41: note: in definition of macro ‘L’
    3 | #define L(i, a, b) for (rg int i = (a); i <= (b); i++)
      |                                         ^
answer.code:42:25: error: ‘ckmin’ was not declared in this scope
   42 |                         ckmin(mn, ret);
      |                         ^~~~~