結果
問題 | No.2408 Lakes and Fish |
ユーザー |
|
提出日時 | 2024-05-01 22:41:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 534 bytes |
コンパイル時間 | 1,596 ms |
コンパイル使用メモリ | 171,584 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-11-22 06:04:17 |
合計ジャッジ時間 | 5,671 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 1 |
ソースコード
#include<bits/stdc++.h> #include <vector> using namespace std; #define ll long long #define ld long double const ll M = 1e9+7; int main() { ll n,m,ans=0;cin >> m >> n;set <ll> arr; for (ll i = 0; i < m; i++){ll a;cin >> a;arr.insert(a);} while(n--){ ll cor,a,b;cin >> cor >> a >> b; auto it=arr.lower_bound(cor); auto _it=it; if(it==arr.end())it--; if(it!=arr.begin())_it--; if(*it==cor)ans+=b; else ans+=max({a,b-abs(cor-*_it),b-abs(*it-cor)}); }cout << ans; }