結果

問題 No.2330 Eat Slime
ユーザー dyktr_06dyktr_06
提出日時 2023-04-13 21:30:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 253 ms / 4,000 ms
コード長 1,097 bytes
コンパイル時間 4,491 ms
コンパイル使用メモリ 263,776 KB
実行使用メモリ 19,260 KB
最終ジャッジ日時 2024-04-17 23:59:49
合計ジャッジ時間 10,886 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 219 ms
16,372 KB
testcase_08 AC 106 ms
11,628 KB
testcase_09 AC 218 ms
15,540 KB
testcase_10 AC 37 ms
5,648 KB
testcase_11 AC 36 ms
5,376 KB
testcase_12 AC 224 ms
15,756 KB
testcase_13 AC 212 ms
15,728 KB
testcase_14 AC 61 ms
6,992 KB
testcase_15 AC 135 ms
12,832 KB
testcase_16 AC 204 ms
14,844 KB
testcase_17 AC 240 ms
19,140 KB
testcase_18 AC 246 ms
19,008 KB
testcase_19 AC 242 ms
19,012 KB
testcase_20 AC 243 ms
19,136 KB
testcase_21 AC 248 ms
19,260 KB
testcase_22 AC 247 ms
19,004 KB
testcase_23 AC 253 ms
19,136 KB
testcase_24 AC 243 ms
19,004 KB
testcase_25 AC 249 ms
19,008 KB
testcase_26 AC 245 ms
19,132 KB
testcase_27 AC 247 ms
19,136 KB
testcase_28 AC 245 ms
19,132 KB
testcase_29 AC 245 ms
19,132 KB
testcase_30 AC 245 ms
19,136 KB
testcase_31 AC 239 ms
19,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m; cin >> n >> m;
    int x; cin >> x;
    vector<int> c(n);
    for(int i = 0; i < n; i++){
        cin >> c[i]; c[i]--;
    }
    vector<int> a(m), b(m);
    vector<int> y(m);
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i] >> y[i];
        a[i]--, b[i]--;
    }
    vector<int> res(n + 1);
    for(int i = 0; i <= n; i++){
        res[i] = x * i;
    }
    vector<vector<int>> q(5, vector<int>(n));
    for(int i = 0; i < m; i++){
        q[b[i]][a[i]] += y[i];
    }
    for(int i = 0; i < 5; i++){
        vector<int> p(n);
        for(int j = 0; j < n; j++){
            if(c[j] == i){
                p[j] += 1;
            }
        }
        reverse(q[i].begin(), q[i].end());
        vector<int> r = convolution(p, q[i]);
        for(int j = n - 1; j < 2 * n - 1; j++){
            res[j - n + 1] += r[j];
        }
    }
    int ans = *max_element(res.begin(), res.end());
    cout << ans << endl;
}
0