結果

問題 No.2644 Iro Iro-Iro
ユーザー 👑 hitonanodehitonanode
提出日時 2024-02-25 00:16:01
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 851 bytes
コンパイル時間 2,770 ms
コンパイル使用メモリ 142,072 KB
実行使用メモリ 31,900 KB
最終ジャッジ日時 2024-02-25 00:16:13
合計ジャッジ時間 10,805 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
31,896 KB
testcase_01 AC 163 ms
31,896 KB
testcase_02 AC 163 ms
31,896 KB
testcase_03 AC 168 ms
31,900 KB
testcase_04 AC 173 ms
31,900 KB
testcase_05 AC 169 ms
31,900 KB
testcase_06 AC 168 ms
31,900 KB
testcase_07 AC 170 ms
31,900 KB
testcase_08 AC 169 ms
31,900 KB
testcase_09 AC 165 ms
31,900 KB
testcase_10 AC 168 ms
31,900 KB
testcase_11 AC 167 ms
31,900 KB
testcase_12 AC 163 ms
31,900 KB
testcase_13 AC 209 ms
31,900 KB
testcase_14 AC 212 ms
31,900 KB
testcase_15 AC 211 ms
31,900 KB
testcase_16 AC 213 ms
31,900 KB
testcase_17 AC 212 ms
31,900 KB
testcase_18 AC 213 ms
31,900 KB
testcase_19 AC 214 ms
31,900 KB
testcase_20 AC 211 ms
31,900 KB
testcase_21 AC 213 ms
31,900 KB
testcase_22 AC 214 ms
31,900 KB
testcase_23 AC 219 ms
31,900 KB
testcase_24 AC 214 ms
31,900 KB
testcase_25 AC 214 ms
31,900 KB
testcase_26 AC 219 ms
31,900 KB
testcase_27 AC 219 ms
31,900 KB
testcase_28 AC 167 ms
31,896 KB
testcase_29 AC 213 ms
31,900 KB
testcase_30 AC 195 ms
31,900 KB
testcase_31 AC 198 ms
31,900 KB
testcase_32 AC 201 ms
31,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>

#include <atcoder/modint>
#include <atcoder/convolution>

using namespace std;

using mint = atcoder::modint998244353;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    constexpr int D = 101;

    auto f = [&](int a, int b, int c) { return (a * D + b) * D + c; };

    vector<mint> dp(D * D * D);

    for (int i = 0; i < N; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        dp.at(f(a, b, c)) += 1;
    }

    auto dprev = dp;
    reverse(dprev.begin(), dprev.end());
    auto conv = atcoder::convolution(dprev, dp);

    int hi = N;
    for (int i = 0; i < M; ++i) {
        int x, y, z;
        cin >> x >> y >> z;
        hi = min<int>(hi, conv.at(D * D * D - 1 + f(x, y, z)).val());
    }

    cout << N * 2 - hi << '\n';
}
0