QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#618291#9417. Palindromic Polygonsupepapupu#Compile Error//C++202.1kb2024-10-06 20:31:402024-10-06 20:31:40

Judging History

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

  • [2024-10-06 20:31:40]
  • 评测
  • [2024-10-06 20:31:40]
  • 提交

answer

#include <bits/stdc++.h>

#define x first
#define y second
#define el '\n'
#define debug(x) cerr << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 3e5 + 10, mod = 998244353;
const ll INF = 4e18;

pll operator-(const pll &a, const pll &b) {
    return {a.x - b.x, a.y - b.y};
}
ll operator^(const pll &a, const pll &b) {
    return a.x * b.y - a.y * b.x;
}
ll area(const pll &a, const pll &b, const pll &c) {
    return abs((b - a) ^ (c - a));
}
__int128 sq(ll x) {
    return (__int128)x * x;
}

void solve() {
    int n; cin >> n;
    vector<int> s(n);
    vector<pll> q(n);
    for (int i = 0; i < n; ++i) cin >> s[i], s.emplace_back(s[i]);
    for (int i = 0; i < n; ++i) {
        cin >> q[i].x >> q[i].y;
        q.emplace_back(q[i]);
    }
    vector<vector<int>> match(n * 2, vector<int>(n * 2)), match2(n * 2, vector<int>(n * 2));
    for (int i = 0; i < n * 2; ++i) {
        match[i][i] = match2[i][i] = i;
        for (int j = i + 1; j < n * 2; ++j) {
            match[i][j] = match[i][j - 1];
            if (s[i] == s[j]) match[i][j] = j;
        }
        for (int j = i - 1; j >= 0; --j) {
            match2[i][j] = match2[i][j + 1];
            if (s[i] == s[j]) match2[i][j] = j;
        }
    }
    vector<vector<ll>> f(n * 2, vector<ll>(n * 2));
    ll ans = 0;
    for (int len = 1; len < n; ++len) {
        for (int i = 0; i + len < n * 2; ++i) {
            int j = i + len;
            if (s[i] != s[j]) continue;
            for (int k = i + 1; k < j; ++k) {
                ll t = area(q[j], q[i], q[k]);
                f[i][j] = max(f[i][j], t + area(q[j], q[k], q[match[k][jj]]) + f[k][match[k][jj]]);
                f[i][j] = max(f[i][j], t + area(q[i], q[match2[k][ii]], q[k]) + f[match2[k][ii]][k]);
            }
            ans = max(ans, f[i][j]);
        }
    }
    cout << ans << el;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int tcase = 1;
    cin >> tcase;
    while (tcase--) solve();
}

详细

answer.code: In function ‘void solve()’:
answer.code:56:72: error: ‘jj’ was not declared in this scope; did you mean ‘j’?
   56 |                 f[i][j] = max(f[i][j], t + area(q[j], q[k], q[match[k][jj]]) + f[k][match[k][jj]]);
      |                                                                        ^~
      |                                                                        j
answer.code:57:67: error: ‘ii’ was not declared in this scope; did you mean ‘i’?
   57 |                 f[i][j] = max(f[i][j], t + area(q[i], q[match2[k][ii]], q[k]) + f[match2[k][ii]][k]);
      |                                                                   ^~
      |                                                                   i