結果

問題 No.814 ジジ抜き
ユーザー tottoripapertottoripaper
提出日時 2019-04-13 13:44:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 305 ms / 3,000 ms
コード長 917 bytes
コンパイル時間 2,219 ms
コンパイル使用メモリ 165,016 KB
実行使用メモリ 10,448 KB
最終ジャッジ日時 2023-10-13 14:17:30
合計ジャッジ時間 10,790 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,392 KB
testcase_01 AC 4 ms
7,372 KB
testcase_02 AC 3 ms
7,516 KB
testcase_03 AC 5 ms
7,452 KB
testcase_04 AC 301 ms
10,392 KB
testcase_05 AC 305 ms
10,384 KB
testcase_06 AC 304 ms
10,308 KB
testcase_07 AC 155 ms
8,640 KB
testcase_08 AC 291 ms
10,292 KB
testcase_09 AC 216 ms
9,416 KB
testcase_10 AC 289 ms
10,216 KB
testcase_11 AC 291 ms
10,384 KB
testcase_12 AC 149 ms
8,520 KB
testcase_13 AC 151 ms
8,580 KB
testcase_14 AC 224 ms
9,532 KB
testcase_15 AC 117 ms
8,276 KB
testcase_16 AC 116 ms
8,300 KB
testcase_17 AC 236 ms
9,664 KB
testcase_18 AC 202 ms
9,068 KB
testcase_19 AC 292 ms
10,448 KB
testcase_20 AC 151 ms
8,540 KB
testcase_21 AC 169 ms
8,732 KB
testcase_22 AC 248 ms
9,856 KB
testcase_23 AC 126 ms
8,452 KB
testcase_24 AC 217 ms
9,316 KB
testcase_25 AC 175 ms
8,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
ll K[300100], L[300100], D[300100];

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> N;

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

    ll lb = 0, ub = 1001001001001001001;

    while(ub - lb > 1){
        ll m = (lb + ub) / 2, eo = 0;
        
        for(int i=0;i<N;++i){
            ll l = L[i], r = l + (K[i] - 1) * (1ll << D[i]),
                n = (std::min(m, r + 1) - std::min(m, l) + (1ll << D[i]) - 1) / (1ll << D[i]);

            eo = eo ^ (n & 1);
        }

        if(eo == 0){
            lb = m;
        }else{
            ub = m;
        }
    }

    std::cout << lb << std::endl;
}
0