結果

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

ソースコード

diff #

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

const int mx = 110; // not 101
const int tot = mx*mx*mx;

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

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