結果
問題 |
No.2408 Lakes and Fish
|
ユーザー |
![]() |
提出日時 | 2024-05-01 22:39:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 544 bytes |
コンパイル時間 | 2,990 ms |
コンパイル使用メモリ | 248,788 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2024-11-22 05:59:21 |
合計ジャッジ時間 | 7,319 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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==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; }