結果

問題 No.2330 Eat Slime
ユーザー googol_S0googol_S0
提出日時 2023-05-28 14:36:06
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 977 ms / 4,000 ms
コード長 667 bytes
コンパイル時間 5,162 ms
コンパイル使用メモリ 310,560 KB
実行使用メモリ 47,536 KB
最終ジャッジ日時 2023-08-27 10:10:56
合計ジャッジ時間 27,494 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 896 ms
38,788 KB
testcase_08 AC 443 ms
31,640 KB
testcase_09 AC 893 ms
33,460 KB
testcase_10 AC 135 ms
8,740 KB
testcase_11 AC 106 ms
5,036 KB
testcase_12 AC 891 ms
35,812 KB
testcase_13 AC 868 ms
38,512 KB
testcase_14 AC 201 ms
7,708 KB
testcase_15 AC 520 ms
31,256 KB
testcase_16 AC 857 ms
33,880 KB
testcase_17 AC 975 ms
47,392 KB
testcase_18 AC 974 ms
47,444 KB
testcase_19 AC 975 ms
47,500 KB
testcase_20 AC 970 ms
47,384 KB
testcase_21 AC 972 ms
47,436 KB
testcase_22 AC 975 ms
47,428 KB
testcase_23 AC 974 ms
47,436 KB
testcase_24 AC 973 ms
47,380 KB
testcase_25 AC 974 ms
47,524 KB
testcase_26 AC 975 ms
47,432 KB
testcase_27 AC 975 ms
47,380 KB
testcase_28 AC 975 ms
47,536 KB
testcase_29 AC 972 ms
47,312 KB
testcase_30 AC 977 ms
47,440 KB
testcase_31 AC 974 ms
47,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
typedef long long ll;

int main(){
  int N,M;
  ll x;
  cin>>N>>M>>x;
  vector<int> C(N);
  vector<vector<ll>> X(5,vector<ll>(N+1,0));
  for(int i=0;i<N;i++){
    cin>>C[i];
    C[i]--;
    X[C[i]][i+1]=1;
  }
  vector<vector<ll>> Y(5,vector<ll>(N+1,0));
  for(int i=0;i<M;i++){
    int a,b;
    ll y;
    cin>>a>>b>>y;
    b--;
    Y[b][N-a]+=y;
  }
  vector<vector<ll>> Z(5);
  for(int i=0;i<5;i++){
    Z[i]=convolution_ll(X[i],Y[i]);
  }
  ll ANS=0;
  for(int i=0;i<=N;i++){
    ANS=max(ANS,i*x+Z[0][N+i]+Z[1][N+i]+Z[2][N+i]+Z[3][N+i]+Z[4][N+i]);
  }
  cout<<ANS<<endl;
}
0