結果

問題 No.2330 Eat Slime
ユーザー HaaHaa
提出日時 2023-05-28 15:38:48
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 893 ms / 4,000 ms
コード長 950 bytes
コンパイル時間 3,801 ms
コンパイル使用メモリ 227,680 KB
実行使用メモリ 99,480 KB
最終ジャッジ日時 2023-08-27 12:37:08
合計ジャッジ時間 24,633 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 812 ms
82,940 KB
testcase_08 AC 720 ms
71,572 KB
testcase_09 AC 820 ms
72,724 KB
testcase_10 AC 132 ms
15,128 KB
testcase_11 AC 105 ms
7,908 KB
testcase_12 AC 812 ms
77,220 KB
testcase_13 AC 789 ms
83,028 KB
testcase_14 AC 199 ms
13,356 KB
testcase_15 AC 796 ms
70,548 KB
testcase_16 AC 783 ms
73,724 KB
testcase_17 AC 884 ms
99,300 KB
testcase_18 AC 886 ms
99,304 KB
testcase_19 AC 881 ms
99,272 KB
testcase_20 AC 882 ms
99,144 KB
testcase_21 AC 881 ms
98,984 KB
testcase_22 AC 882 ms
98,976 KB
testcase_23 AC 886 ms
99,480 KB
testcase_24 AC 883 ms
99,040 KB
testcase_25 AC 893 ms
98,912 KB
testcase_26 AC 889 ms
99,196 KB
testcase_27 AC 885 ms
99,296 KB
testcase_28 AC 891 ms
99,176 KB
testcase_29 AC 884 ms
99,108 KB
testcase_30 AC 883 ms
99,128 KB
testcase_31 AC 884 ms
99,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T& x, const T& y){return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T& x, const T& y){return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;

int main(){
    int n, m, x; cin >> n >> m >> x;
    VI c(n); REP(i,n) cin >> c[i], c[i]--;
    VI l(n*5,0), r(n*5,0);
    REP(i,n) l[i*5+c[i]]=1;
    int a, b, y;
    REP(i,m){
        cin >> a >> b >> y;
        a--, b--;
        r[a*5+b]+=y;
    }
    reverse(ALL(r));
    auto res=convolution_ll(l,r);
    int s=res.size();
    ll ans=n*x, z=0;
    for(int i=n*5-1;i<s;i+=5){
        chmax(ans,res[i]+z);
        z+=x;
    }
    cout << ans << endl;
    return 0;
}
0