結果
問題 |
No.2408 Lakes and Fish
|
ユーザー |
|
提出日時 | 2025-08-25 12:12:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 180 ms / 2,000 ms |
コード長 | 498 bytes |
コンパイル時間 | 1,935 ms |
コンパイル使用メモリ | 195,772 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-25 12:12:42 |
合計ジャッジ時間 | 6,464 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N, M; cin >> N >> M; vector<int> L(N); for (int i = 0; i < N; i++){ cin >> L[i]; } long long ans = 0; for (int i = 0; i < M; i++){ int F, B, W; cin >> F >> B >> W; int p = lower_bound(L.begin(), L.end(), F) - L.begin(); int tmp = B; if (p >= 1){ tmp = max(tmp, W - (F - L[p - 1])); } if (p < N){ tmp = max(tmp, W - (L[p] - F)); } ans += tmp; } cout << ans << endl; }