結果
| 問題 | No.2408 Lakes and Fish |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-05-02 00:05:43 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,396 bytes |
| 記録 | |
| コンパイル時間 | 1,342 ms |
| コンパイル使用メモリ | 215,040 KB |
| 実行使用メモリ | 1,300,420 KB |
| 最終ジャッジ日時 | 2026-07-04 16:02:53 |
| 合計ジャッジ時間 | 3,540 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 1 MLE * 2 -- * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int N, M;
cin >> N >> M;
vector<int> L(N);
for (int i = 0; i < N; ++i) {
cin >> L[i];
}
vector<int> F(M), B(M), W(M);
for (int i = 0; i < M; ++i) {
cin >> F[i];
}
for (int i = 0; i < M; ++i) {
cin >> B[i];
}
for (int i = 0; i < M; ++i) {
cin >> W[i];
}
long long sun_strength = 0, total_moves = 0;
for (int i = 0; i < M; ++i) {
if (F[i] <= L[0]) {
sun_strength += B[i];
} else {
sun_strength += W[i];
}
}
long long max_magic = sun_strength;
for (int i = 1; i < N; ++i) {
long long new_sun_strength = sun_strength;
for (int j = 0; j < M; ++j) {
if (F[j] <= L[i]) {
new_sun_strength += B[j];
} else {
new_sun_strength += W[j];
}
}
long long moves = abs(L[i] - L[i - 1]);
max_magic = max(max_magic, new_sun_strength - moves);
sun_strength = new_sun_strength;
total_moves += moves;
}
cout << max_magic - total_moves << endl;
}
return 0;
}
vjudge1