結果

問題 No.814 ジジ抜き
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-28 22:19:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 477 ms / 3,000 ms
コード長 906 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 82,876 KB
実行使用メモリ 10,548 KB
最終ジャッジ日時 2023-09-22 04:33:42
合計ジャッジ時間 10,304 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,420 KB
testcase_01 AC 2 ms
7,384 KB
testcase_02 AC 3 ms
7,400 KB
testcase_03 AC 6 ms
7,428 KB
testcase_04 AC 477 ms
10,548 KB
testcase_05 AC 476 ms
10,384 KB
testcase_06 AC 474 ms
10,300 KB
testcase_07 AC 189 ms
8,640 KB
testcase_08 AC 335 ms
10,284 KB
testcase_09 AC 345 ms
9,324 KB
testcase_10 AC 458 ms
10,240 KB
testcase_11 AC 468 ms
10,300 KB
testcase_12 AC 226 ms
8,564 KB
testcase_13 AC 222 ms
8,512 KB
testcase_14 AC 334 ms
9,708 KB
testcase_15 AC 177 ms
8,396 KB
testcase_16 AC 146 ms
8,272 KB
testcase_17 AC 381 ms
9,712 KB
testcase_18 AC 309 ms
9,148 KB
testcase_19 AC 379 ms
10,260 KB
testcase_20 AC 237 ms
8,548 KB
testcase_21 AC 219 ms
8,808 KB
testcase_22 AC 284 ms
9,752 KB
testcase_23 AC 171 ms
8,452 KB
testcase_24 AC 270 ms
9,564 KB
testcase_25 AC 208 ms
8,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if (a < b){ a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b){ if (a > b){ a = b; return true; } return false; }

using ll = long long;
ll K[303030], L[303030], D[303030];
ll two[100];
int n;

bool F(ll x) {
    ll cnt = 0;
    for (int i=0; i<n; ++i) {
        if (x < L[i]) continue;
        cnt += min(K[i], 1 + (x-L[i])/two[D[i]]);
    }
    return cnt%2;
}

int main() {
    two[0] = 1;
    for (int i=1; i<60; ++i) two[i] = two[i-1]*2;

    cin >> n;
    for (int i=0; i<n; ++i) {
        cin >> K[i] >> L[i] >> D[i];
    }

    ll l=-1, r=1e18;
    while (r-l>1) {
        ll m = (r+l)/2;
        if (F(m)) r = m;
        else l = m;
    }
    cout << r << endl;
}
0