結果
問題 | No.2330 Eat Slime |
ユーザー |
![]() |
提出日時 | 2023-05-28 15:07:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 940 ms / 4,000 ms |
コード長 | 901 bytes |
コンパイル時間 | 4,232 ms |
コンパイル使用メモリ | 136,416 KB |
実行使用メモリ | 41,292 KB |
最終ジャッジ日時 | 2024-12-27 04:51:29 |
合計ジャッジ時間 | 25,494 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <iostream>#include <vector>using namespace std;using lint = long long;#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)#define REP(i, n) FOR(i,0,n)#include <atcoder/convolution>int main() {cin.tie(nullptr), ios::sync_with_stdio(false);int N, M, X;cin >> N >> M >> X;constexpr int C = 5;vector onset(C, vector<lint>(N + 1)), match(C, vector<lint>(N));REP(i, N) {int c;cin >> c;onset.at(c - 1).at(i) = 1;}while (M--) {int a, b, y;cin >> a >> b >> y;match.at(b - 1).at(N - a) += y;}REP(c, C) match.at(c) = atcoder::convolution_ll(match.at(c), onset.at(c));lint ret = 0;REP(i, N + 1) {lint tmp = i * lint(X);for (const auto &v : match) tmp += v.at(N - 1 + i);ret = max(ret, tmp);}cout << ret << endl;}