結果
| 問題 |
No.2408 Lakes and Fish
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-05-01 11:15:07 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 829 bytes |
| コンパイル時間 | 4,450 ms |
| コンパイル使用メモリ | 164,480 KB |
| 実行使用メモリ | 8,064 KB |
| 最終ジャッジ日時 | 2024-11-21 15:08:22 |
| 合計ジャッジ時間 | 8,221 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define sec second
#define pairz pair<ll,ll>
#define pb push_back
ll tc = 1;
const ll INF = 1e18;
const ll N = 1e6+5;
const ll MOD = 1e9 + 7;
// thy will, not mine, be done.
void input(){
ll n,m; cin >> n >> m;
set<ll>st;
for(int i=1;i<=n;i++){
ll x; cin >> x;
st.insert(x);
}
ll ans = 0;
for(int i=1;i<=m;i++){
ll f,b,w; cin >> f >> b >> w;
auto x = st.lower_bound(f);
auto y = x;
if(x != st.begin()) --x;
if(*y == f) ans += w;
else{
ans += max({b, w - abs(*y - f), w - abs(f - *x)});
}
}
cout << ans << endl;
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr);
// cin >> tc;
while(tc--) input();
}
/*
usahain clean code, jangan ribet2 implementasinya
11 + 14 + 8 = 33
2023 - 2013 2
*/
vjudge1