QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#864545 | #9678. 网友小 Z 的树 | KaXdd_# | Compile Error | / | / | C++14 | 918b | 2025-01-20 18:37:44 | 2025-01-20 18:37:52 |
Judging History
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;
}
}
}
}
Details
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); | ^~~~~