結果

問題 No.814 ジジ抜き
ユーザー risujirohrisujiroh
提出日時 2019-04-12 22:18:54
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 149 ms / 3,000 ms
コード長 748 bytes
コンパイル時間 1,612 ms
コンパイル使用メモリ 168,344 KB
実行使用メモリ 10,168 KB
最終ジャッジ日時 2023-10-12 21:37:34
合計ジャッジ時間 5,925 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 3 ms
4,352 KB
testcase_04 AC 148 ms
10,128 KB
testcase_05 AC 146 ms
10,168 KB
testcase_06 AC 149 ms
9,868 KB
testcase_07 AC 76 ms
6,560 KB
testcase_08 AC 145 ms
9,968 KB
testcase_09 AC 107 ms
8,056 KB
testcase_10 AC 145 ms
9,832 KB
testcase_11 AC 146 ms
9,920 KB
testcase_12 AC 73 ms
6,552 KB
testcase_13 AC 75 ms
6,488 KB
testcase_14 AC 112 ms
8,512 KB
testcase_15 AC 58 ms
5,744 KB
testcase_16 AC 58 ms
5,696 KB
testcase_17 AC 119 ms
8,620 KB
testcase_18 AC 100 ms
7,808 KB
testcase_19 AC 146 ms
9,924 KB
testcase_20 AC 74 ms
6,476 KB
testcase_21 AC 84 ms
6,964 KB
testcase_22 AC 121 ms
8,528 KB
testcase_23 AC 63 ms
6,004 KB
testcase_24 AC 108 ms
8,064 KB
testcase_25 AC 87 ms
7,004 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 = -1, ok = 1e18;
  while (ok - ng > 1) {
    lint mid = ng + ok >> 1;
    (chk(mid) ? ok : ng) = mid;
  }
  cout << ok << '\n';
}
0