結果

問題 No.2408 Lakes and Fish
ユーザー vjudge1vjudge1
提出日時 2024-05-01 23:50:04
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 728 bytes
コンパイル時間 4,570 ms
コンパイル使用メモリ 274,468 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 23:50:13
合計ジャッジ時間 7,606 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n, m;
    cin >>n >>m;
    int shade[n];
    int FishP[m];
    int Nshade[m];
    int Yshade[m];
    int Dist[m];
    int tot=0;
    int move=0;
    for(int i=0; i<n;i++){
        cin >> shade[i];
    }
    for(int i=0; i<m;i++){
        cin >> FishP[i] >> Nshade[i] >> Yshade[i];
    }
    for(int i=0; i<m; i++){
        Dist[i]=1e9+1;
        for(int j=0;j<n;j++){
            Dist[i]=min(Dist[i], abs(shade[j]-FishP[i]));
        }
        if(Dist[i]<=(Yshade[i]-Nshade[i])){
            move+=Dist[i];
            tot+=Yshade[i];
        }
        else{
            tot+=Nshade[i];
        }
    }
    cout << tot-move;
    return 0;
}
0