結果

問題 No.2330 Eat Slime
ユーザー 👑 hitonanodehitonanode
提出日時 2023-05-28 15:07:55
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 886 ms / 4,000 ms
コード長 901 bytes
コンパイル時間 3,370 ms
コンパイル使用メモリ 136,164 KB
実行使用メモリ 41,276 KB
最終ジャッジ日時 2023-08-27 11:30:06
合計ジャッジ時間 23,018 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 832 ms
33,764 KB
testcase_08 AC 425 ms
27,520 KB
testcase_09 AC 821 ms
29,384 KB
testcase_10 AC 108 ms
7,900 KB
testcase_11 AC 65 ms
4,744 KB
testcase_12 AC 826 ms
31,180 KB
testcase_13 AC 816 ms
33,572 KB
testcase_14 AC 130 ms
6,980 KB
testcase_15 AC 450 ms
27,632 KB
testcase_16 AC 809 ms
29,532 KB
testcase_17 AC 875 ms
41,156 KB
testcase_18 AC 880 ms
41,276 KB
testcase_19 AC 875 ms
41,052 KB
testcase_20 AC 874 ms
41,112 KB
testcase_21 AC 872 ms
41,272 KB
testcase_22 AC 873 ms
41,172 KB
testcase_23 AC 872 ms
41,052 KB
testcase_24 AC 886 ms
41,108 KB
testcase_25 AC 883 ms
41,056 KB
testcase_26 AC 873 ms
41,040 KB
testcase_27 AC 877 ms
41,132 KB
testcase_28 AC 881 ms
41,268 KB
testcase_29 AC 877 ms
41,032 KB
testcase_30 AC 877 ms
41,132 KB
testcase_31 AC 878 ms
41,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0