QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#711061#9581. 都市叠高SulfoxCompile Error//C++20945b2024-11-05 00:10:322024-11-05 00:10:32

Judging History

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

  • [2024-11-05 00:10:32]
  • 评测
  • [2024-11-05 00:10:32]
  • 提交

answer

#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;

using i64 = long long;
using vec = pair<i64, i64>;
#define x first
#define y second

vec operator+(vec a, vec b) {
    return {a.x + b.x, a.y + b.y};
}
vec operator-(vec v) {
    return {-v.x, -v.y};
}
vec operator-(vec a, vec b) {
    return a + -b;
}
double mod(vec v) {
    return hypot(v.x, v.y);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;
    vector<vec> p(n + 1);
    for (int i = 1; i <= n; ++i)
        cin >> p[i].x >> p[i].y;

    vector<double> ans(n + 1);

    for (int i = 1; i <= n; i++)
    {
        ans[i] = ans[i - 1];
        for (int j = 1; j < i; ++j)
            ans[i] = max(ans[i], ans[j - 1] + mod(p[i] - p[j]));
    }
    cout << ans[n] << endl;
}

Details

answer.code: In function ‘double mod(vec)’:
answer.code:23:12: error: ‘hypot’ was not declared in this scope
   23 |     return hypot(v.x, v.y);
      |            ^~~~~