結果

問題 No.2644 Iro Iro-Iro
ユーザー てんぷら
提出日時 2024-02-19 22:26:14
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 759 ms / 2,000 ms
コード長 956 bytes
コンパイル時間 5,333 ms
コンパイル使用メモリ 306,736 KB
実行使用メモリ 100,308 KB
最終ジャッジ日時 2024-09-29 02:20:25
合計ジャッジ時間 28,780 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
using namespace std;
using namespace atcoder;
using mint = modint998244353;
const int inf = 1000000007;
const ll longinf = 1ll << 60;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    int b = 101;
    int all = b * b * b;
    vector<ll> a(all + 1), ra(all + 1);
    rep(i, n) {
        int x, y, z;
        cin >> x >> y >> z;
        int val = b * b * x + b * y + z;
        a[val]++;
        ra[all - val]++;
    }
    auto ret = convolution_ll(a, ra);
    int mi = n;
    rep(i, m) {
        int x, y, z;
        cin >> x >> y >> z;
        int val = b * b * x + b * y + z;
        mi = min(mi, (int)ret[all + val]);
    }
    cout << 2 * n - mi << endl;
    return 0;
}
0