結果
問題 |
No.2330 Eat Slime
|
ユーザー |
![]() |
提出日時 | 2023-05-28 14:27:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 757 bytes |
コンパイル時間 | 4,060 ms |
コンパイル使用メモリ | 254,108 KB |
最終ジャッジ日時 | 2025-02-13 11:30:21 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 RE * 29 |
ソースコード
#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(4,vector<long long>(N)); rep(j,N){ int t; cin>>t; c[t-1][j] = 1; } vector<vector<long long>> t(4,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,4){ 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]); cout<<aa<<endl; return 0; }