結果
問題 |
No.2408 Lakes and Fish
|
ユーザー |
![]() |
提出日時 | 2024-05-01 22:37:26 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 598 bytes |
コンパイル時間 | 2,869 ms |
コンパイル使用メモリ | 248,816 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-11-22 05:56:08 |
合計ジャッジ時間 | 7,168 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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,r=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;_it--; if(*it==cor)ans+=b; else if(it==arr.end())ans+=max(a,b-abs(cor-*_it)); else if(it==arr.begin())ans+=max(a,b-abs(*it-cor)); else ans+=max({a,b-abs(cor-*_it),b-abs(*it-cor)}); }cout << ans; }