結果
| 問題 | No.2408 Lakes and Fish | 
| コンテスト | |
| ユーザー |  vjudge1 | 
| 提出日時 | 2024-05-01 22:51:11 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,110 bytes | 
| コンパイル時間 | 2,079 ms | 
| コンパイル使用メモリ | 194,540 KB | 
| 最終ジャッジ日時 | 2025-02-21 10:05:34 | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 WA * 7 | 
ソースコード
#include <bits/stdc++.h> 
#include <cctype>
using namespace std; 
#define fi first
#define se second
#define int long long
#define all(v) v.begin(), v.end()
#define pb push_back
#define rep(i, a, b) for (int i = a; i <= b; i++)
//iota(first, last, 1);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef pair<string, ii> sii;
typedef pair<int, ii> iii;
const int INF = 3e18;
const long double EPS = 10e-9;
const ll MOD = 1e9+7;
signed main() {
	ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n, m; cin >> n >> m;	
	vector<int> l;
	for (int i=1; i<=n; i++) {
		int a; cin >> a; l.pb(a);
	}
	int ans = 0;
	for (int i=1; i<=m; i++) {
		int f, b, w; cin >> f >> b >> w;
		int x = b; 
		auto itr = lower_bound(l.begin(), l.end(), f);
		if (itr != l.end()) {
			x = max(x, w - abs(f - *itr));
			// c << *itr << " " << f << '\n';
		} 
		if (itr != l.begin() + 1) {
			x = max(x, w - abs(f - *(--itr)));
		} 
		// cout << *itr << " " << f << '\n';
		ans += x;
	} cout << ans;
	return 0;
} 
            
            
            
        