結果

問題 No.2330 Eat Slime
ユーザー m_99m_99
提出日時 2023-05-28 14:31:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 985 ms / 4,000 ms
コード長 787 bytes
コンパイル時間 4,272 ms
コンパイル使用メモリ 261,908 KB
実行使用メモリ 37,080 KB
最終ジャッジ日時 2023-08-27 10:01:27
合計ジャッジ時間 26,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 903 ms
31,100 KB
testcase_08 AC 444 ms
24,444 KB
testcase_09 AC 895 ms
25,028 KB
testcase_10 AC 136 ms
7,240 KB
testcase_11 AC 106 ms
4,488 KB
testcase_12 AC 908 ms
28,576 KB
testcase_13 AC 872 ms
31,012 KB
testcase_14 AC 201 ms
6,460 KB
testcase_15 AC 524 ms
24,340 KB
testcase_16 AC 858 ms
25,324 KB
testcase_17 AC 980 ms
36,932 KB
testcase_18 AC 980 ms
36,736 KB
testcase_19 AC 982 ms
36,948 KB
testcase_20 AC 984 ms
36,828 KB
testcase_21 AC 983 ms
37,076 KB
testcase_22 AC 984 ms
37,060 KB
testcase_23 AC 982 ms
36,788 KB
testcase_24 AC 982 ms
36,940 KB
testcase_25 AC 983 ms
37,080 KB
testcase_26 AC 983 ms
36,736 KB
testcase_27 AC 982 ms
36,948 KB
testcase_28 AC 985 ms
36,820 KB
testcase_29 AC 972 ms
36,936 KB
testcase_30 AC 977 ms
36,904 KB
testcase_31 AC 985 ms
36,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001


int main(){
	
	int N,M,X;
	cin>>N>>M>>X;
	
	vector<vector<long long>> c(5,vector<long long>(N));
	rep(j,N){
		int t;
		cin>>t;
		c[t-1][j] = 1;
	}
	
	vector<vector<long long>> t(5,vector<long long>(N));
	rep(i,M){
		int x,y,z;
		cin>>x>>y>>z;
		x--,y--;
		t[y][N-1-x] += z;
	}
	vector<long long> ans(N);
	rep(i,5){
		auto tt=  convolution_ll(c[i],t[i]);
		rep(j,N){
			ans[j] += tt[N-1+j];
		}
	}
	rep(i,N)ans[i] += X * i;
	
	long long aa = 0;
	rep(i,N)aa = max(aa,ans[i]);
	aa = max(aa,(long long)N*X);
	cout<<aa<<endl;
	
	return 0;
}
0