結果
| 問題 |
No.2408 Lakes and Fish
|
| コンテスト | |
| ユーザー |
hatsuka_iwa
|
| 提出日時 | 2023-09-05 18:14:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 173 ms / 2,000 ms |
| コード長 | 494 bytes |
| コンパイル時間 | 1,510 ms |
| コンパイル使用メモリ | 169,016 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 13:43:30 |
| 合計ジャッジ時間 | 6,061 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, M; cin >> N >> M;
long long Ans = 0;
vector<int> L(N); for (int &a : L) cin >> a;
for (int i = 0; i < M; i++) {
int F, B, W; cin >> F >> B >> W;
int it = lower_bound(L.begin(), L.end(), F) - L.begin();
if (it == 0) Ans += max(B, W - L.at(it) + F);
else if (it == N) Ans += max(B, W - F + L.at(it - 1));
else Ans += max(B, max( W - L.at(it) + F, W - F + L.at(it - 1)));
}
cout << Ans << endl;
}
hatsuka_iwa