結果

問題 No.2644 Iro Iro-Iro
ユーザー noya2
提出日時 2024-02-19 20:31:43
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 5,702 ms
コンパイル使用メモリ 317,948 KB
実行使用メモリ 31,884 KB
最終ジャッジ日時 2024-09-29 01:11:33
合計ジャッジ時間 15,183 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;

const int tot = 101*101*101;

int colid(int a, int b, int c){
    return a + b*101 + c*101*101;
}

int main(){
    int n, m; cin >> n >> m;
    vector<mint> f(tot,0);
    for (int i = 0; i < n; i++){
        int a, b, c; cin >> a >> b >> c;
        f[colid(a,b,c)] = 1;
    }
    auto g = f;
    reverse(g.begin(),g.end());
    auto fg = atcoder::convolution(f,g);
    int ans = 0;
    for (int i = 0; i < m; i++){
        int x, y, z; cin >> x >> y >> z;
        int d = colid(x,y,z);
        int sum = fg[tot-1-d].val();
        ans = max(ans,n+n-sum);
    }
    cout << ans << endl;
}
0