結果
| 問題 | No.705 ゴミ拾い Hard |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-25 00:55:35 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 915 bytes |
| 記録 | |
| コンパイル時間 | 372 ms |
| コンパイル使用メモリ | 80,512 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2026-08-25 00:55:39 |
| 合計ジャッジ時間 | 3,202 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 WA * 13 RE * 1 |
ソースコード
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1010;
const LL INF = 9e18;
PII p[N];
int n, a[N];
LL f[N][N], mi[N];
LL Calc(int hum, int gar) {
int dx = abs(a[hum] - p[gar].first);
int dy = abs(0 - p[gar].second);
return 1LL * dx * dx * dx + 1LL * dy * dy * dy;
}
int main() {
// freopen("gabbage.in", "r", stdin);
// freopen("gabbage.out", "w", stdout);
scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
for (int i = 1; i <= n; ++i) scanf("%d", &p[i].first);
for (int i = 1; i <= n; ++i) scanf("%d", &p[i].second);
for (int i = 1; i <= n; ++i) {
mi[i] = INF;
for (int j = 1; j <= i; ++j) {
f[i][j] = mi[j - 1] + Calc(i, j);
mi[i] = min(mi[i], f[i][j]);
}
}
printf("%lld\n", mi[n]);
return 0;
}