QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863649#5020. 举办乘凉州喵,举办乘凉州谢谢喵cooluoCompile Error//C++231.5kb2025-01-19 20:45:292025-01-19 20:45:29

Judging History

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

  • [2025-01-19 20:45:29]
  • 评测
  • [2025-01-19 20:45:29]
  • 提交

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>
#include "diameter.h"
using namespace std;

#define ll long long
#define pii pair<int, int>
#define mkpr make_pair
#define vi vector<int>
#define all(c) (c).begin(), (c).end()
#define rep(i, l, r) for (int i(l), i##End(r); i <= i##End; i = -~i)

int n, m;
__gnu_pbds::gp_hash_table<ll, int> mp;

int qry(int u, int v, int w) {
    if (u > v) swap(u, v);
    if (v > w) swap(v, w);
    if (u > v) swap(u, v);
    ll x = u * 1000000000000 + v * 1000000 + w;
    if (mp[x]) return mp[x];
    return mp[x] = query(u, v, w);
}

pii find_diameter(int task_id, int n) {
    mp.clear();
    if (n <= 2) return mkpr(1, n);
    int u = 1, v = 2, w = 3;
    rep(i, 1, n) if (i != u && i != v && i != w)
        if (qry(u, v, w) < qry(i, v, w)) u = i;
    rep(i, 1, n) if (i != u && i != v && i != w)
        if (qry(u, v, w) < qry(u, i, w)) v = i;
    rep(i, 1, n) if (i != u && i != v && i != w)
        if (qry(u, v, w) < qry(u, v, i)) w = i;
    int x = 0;
    rep(i, 1, n) if (i != u && i != v && i != w)
        if (!x || qry(u, v, i) < qry(u, v, x)) x = i;
    if (!x) {
        if (in(u, v, w)) return mkpr(v, w);
        if (in(v, u, w)) return mkpr(u, w);
        return mkpr(u, v);
    }
    if (in(u, v, x)) return mkpr(v, w);
    if (in(x, u, w)) swap(u, v);
    int a = qry(u, v, x) >> 1, b = qry(v, w, x) >> 1, c = qry(u, v, w) - a - b;
    int d = max({a, b, c});
    if (d == a) return mkpr(u, v);
    if (d == b) return mkpr(v, w);
    return mkpr(u, w);
}

详细

answer.code:3:10: fatal error: diameter.h: No such file or directory
    3 | #include "diameter.h"
      |          ^~~~~~~~~~~~
compilation terminated.