結果

問題 No.2644 Iro Iro-Iro
ユーザー KumaTachiRenKumaTachiRen
提出日時 2024-02-19 23:12:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 1,882 bytes
コンパイル時間 4,163 ms
コンパイル使用メモリ 270,496 KB
実行使用メモリ 31,900 KB
最終ジャッジ日時 2024-02-19 23:12:39
合計ジャッジ時間 11,514 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
31,896 KB
testcase_01 AC 142 ms
31,896 KB
testcase_02 AC 143 ms
31,896 KB
testcase_03 AC 149 ms
31,900 KB
testcase_04 AC 155 ms
31,900 KB
testcase_05 AC 167 ms
31,900 KB
testcase_06 AC 152 ms
31,900 KB
testcase_07 AC 148 ms
31,900 KB
testcase_08 AC 145 ms
31,900 KB
testcase_09 AC 164 ms
31,900 KB
testcase_10 AC 142 ms
31,900 KB
testcase_11 AC 147 ms
31,900 KB
testcase_12 AC 143 ms
31,900 KB
testcase_13 AC 183 ms
31,900 KB
testcase_14 AC 191 ms
31,900 KB
testcase_15 AC 182 ms
31,900 KB
testcase_16 AC 210 ms
31,900 KB
testcase_17 AC 184 ms
31,900 KB
testcase_18 AC 184 ms
31,900 KB
testcase_19 AC 184 ms
31,900 KB
testcase_20 AC 185 ms
31,900 KB
testcase_21 AC 183 ms
31,900 KB
testcase_22 AC 202 ms
31,900 KB
testcase_23 AC 185 ms
31,900 KB
testcase_24 AC 181 ms
31,900 KB
testcase_25 AC 188 ms
31,900 KB
testcase_26 AC 192 ms
31,900 KB
testcase_27 AC 183 ms
31,900 KB
testcase_28 AC 164 ms
31,896 KB
testcase_29 AC 188 ms
31,900 KB
testcase_30 AC 170 ms
31,900 KB
testcase_31 AC 175 ms
31,900 KB
testcase_32 AC 177 ms
31,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;
using namespace atcoder;

struct Fast {
  Fast() {
    std::cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(10);
  }
} fast;

#define all(a) (a).begin(), (a).end()
#define contains(a, x) ((a).find(x) != (a).end())
#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (a); i--)
#define YN(b) cout << ((b) ? "YES" : "NO") << "\n";
#define Yn(b) cout << ((b) ? "Yes" : "No") << "\n";
#define yn(b) cout << ((b) ? "yes" : "no") << "\n";

template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  }
  return os;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

using ll = long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

using mint = modint998244353;
using vm = vector<mint>;
using vvm = vector<vm>;
inline ostream &operator<<(ostream &os, const mint x) { return os << x.val(); };

void solve() {
  const int d = 101;
  const int d3 = d * d * d;
  int n, m;
  cin >> n >> m;
  vm f(d3, 0);
  rep(i, 0, n) {
    int a, b, c;
    cin >> a >> b >> c;
    f[a + b * d + c * d * d] += 1;
  }
  vm g(d3);
  rep(i, 0, d3) g[i] = f[d3 - 1 - i];
  f = convolution(f, g);
  int ans = 0;
  rep(i, 0, m) {
    int x, y, z;
    cin >> x >> y >> z;
    x = x + y * d + z * d * d;
    int v = 2 * n - (int)(f[x + d3 - 1].val());
    chmax(ans, v);
  }
  cout << ans << "\n";
}

int main() {
  int t = 1;
  // cin >> t;
  while (t--) solve();
}
0