結果

問題 No.2408 Lakes and Fish
ユーザー vjudge1vjudge1
提出日時 2024-05-01 23:29:37
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,601 bytes
コンパイル時間 3,022 ms
コンパイル使用メモリ 244,628 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-05-01 23:29:46
合計ジャッジ時間 8,946 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,704 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 990 ms
5,376 KB
testcase_03 AC 478 ms
5,376 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'long long int bin()':
main.cpp:24:1: warning: no return statement in function returning non-void [-Wreturn-type]
   24 | }
      | ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#define fi first
#define se second
const int MOD = 1e9+7;
#define pin pair<int,int>
#define lup(i,x) for(int i=0; i<x; i++)
#define pb push_back
#define pu push
#define vint vector<int>
#define nitro ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define din(x) int x;cin>>x;
#define endl '\n'
#define cout std::cout
const int maxn = 1e9+5;
bool ar[maxn];

int bin(){

}

void solve(){
     int n, m;
     cin >> n >> m;
     for(int i = 0; i < n; i++){
          int a;
          cin >> a;
          ar[a] = true;
     }
     int sum = 0;
     for(int i = 0; i < m; i ++ ){
          int f, b, w;
          cin >> f >> b >> w;
          if(ar[f]==true){
               sum += w;
          }else{
               int ma = 1e11;
               for(int j = f+1; j < maxn; j++){
                    if(ar[j] == true) {ma = min(ma,(j-f)); break;};
               }
               for(int j = f-1; j>=0; j--){
                    if(ar[j] == true) {
                         ma = min(ma,(f-j));
                    }
               }
               if(ma==1e11){
                    sum+=b;
               }else{
                    if(b < w-ma){
                         sum += w-ma;
                    }else{
                         sum += b;
                    }
               }
          }
     }
     cout << sum << endl;
}

signed main(){
     // nitro
     // int n;
     // cin >> n;
     // while(n--){
          solve();
     // }
}
0