結果

問題 No.814 ジジ抜き
ユーザー risujirohrisujiroh
提出日時 2019-04-12 22:18:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 747 bytes
コンパイル時間 2,534 ms
コンパイル使用メモリ 166,916 KB
実行使用メモリ 10,232 KB
最終ジャッジ日時 2023-10-12 21:36:55
合計ジャッジ時間 6,565 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 3 ms
4,372 KB
testcase_04 AC 144 ms
10,232 KB
testcase_05 AC 144 ms
10,164 KB
testcase_06 AC 148 ms
9,864 KB
testcase_07 AC 75 ms
6,728 KB
testcase_08 AC 144 ms
9,868 KB
testcase_09 AC 105 ms
8,020 KB
testcase_10 AC 142 ms
9,720 KB
testcase_11 AC 145 ms
9,920 KB
testcase_12 AC 73 ms
6,424 KB
testcase_13 AC 75 ms
6,720 KB
testcase_14 AC 111 ms
8,576 KB
testcase_15 AC 58 ms
5,700 KB
testcase_16 AC 58 ms
5,736 KB
testcase_17 AC 117 ms
8,668 KB
testcase_18 AC 100 ms
7,792 KB
testcase_19 AC 141 ms
9,844 KB
testcase_20 AC 74 ms
6,540 KB
testcase_21 AC 83 ms
7,024 KB
testcase_22 AC 121 ms
8,868 KB
testcase_23 AC 62 ms
5,904 KB
testcase_24 AC 107 ms
8,112 KB
testcase_25 AC 85 ms
6,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<lint> k(n), l(n), d(n); for (int i = 0; i < n; ++i) cin >> k[i] >> l[i] >> d[i];
  auto chk = [&](lint x) -> bool {
    lint s = 0;
    for (int i = 0; i < n; ++i) {
      s += max(min(l[i] + (k[i] << d[i]), x + 1) - l[i], 0LL) + ~(~0LL << d[i]) >> d[i];
    }
    return s & 1;
  };
  for (int i = 1; i <= 10; ++i) {
    cerr << i << ' ' << chk(i) << '\n';
  }
  lint ng = 0, ok = 1e18;
  while (ok - ng > 1) {
    lint mid = ng + ok >> 1;
    (chk(mid) ? ok : ng) = mid;
  }
  cout << ok << '\n';
}
0