結果

問題 No.814 ジジ抜き
ユーザー finefine
提出日時 2019-04-12 23:26:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 333 ms / 3,000 ms
コード長 652 bytes
コンパイル時間 1,701 ms
コンパイル使用メモリ 166,768 KB
実行使用メモリ 10,172 KB
最終ジャッジ日時 2023-10-13 09:12:25
合計ジャッジ時間 7,823 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 4 ms
4,348 KB
testcase_04 AC 333 ms
10,172 KB
testcase_05 AC 333 ms
10,164 KB
testcase_06 AC 323 ms
9,964 KB
testcase_07 AC 95 ms
6,460 KB
testcase_08 AC 151 ms
9,776 KB
testcase_09 AC 235 ms
7,996 KB
testcase_10 AC 290 ms
9,708 KB
testcase_11 AC 318 ms
10,032 KB
testcase_12 AC 139 ms
6,420 KB
testcase_13 AC 136 ms
6,532 KB
testcase_14 AC 201 ms
8,476 KB
testcase_15 AC 111 ms
5,688 KB
testcase_16 AC 74 ms
5,616 KB
testcase_17 AC 260 ms
8,596 KB
testcase_18 AC 192 ms
7,728 KB
testcase_19 AC 206 ms
9,972 KB
testcase_20 AC 157 ms
6,532 KB
testcase_21 AC 117 ms
6,992 KB
testcase_22 AC 133 ms
8,604 KB
testcase_23 AC 97 ms
6,168 KB
testcase_24 AC 140 ms
8,036 KB
testcase_25 AC 102 ms
7,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> K(n), L(n), D(n);
    for (int i = 0; i < n; i++) {
        cin >> K[i] >> L[i] >> D[i];
    }

    ll ok = 1000000000000000000LL, ng = -1;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        for (int i = 0; i < n; i++) {
            if (mid < L[i]) continue;
            (cnt += min((mid - L[i]) / (1LL << D[i]) + 1, K[i]) % 2) %= 2;
        }
        if (cnt == 0) ng = mid;
        else ok = mid;
    }
    cout << ok << endl;
    return 0;
}
0