結果

問題 No.814 ジジ抜き
ユーザー sinsincoscossinsincoscos
提出日時 2019-04-13 15:10:17
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 496 ms / 3,000 ms
コード長 536 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 65,588 KB
実行使用メモリ 10,492 KB
最終ジャッジ日時 2023-10-13 14:21:04
合計ジャッジ時間 9,520 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,636 KB
testcase_01 AC 3 ms
7,440 KB
testcase_02 AC 2 ms
7,432 KB
testcase_03 AC 7 ms
7,444 KB
testcase_04 AC 494 ms
10,352 KB
testcase_05 AC 496 ms
10,460 KB
testcase_06 AC 493 ms
10,308 KB
testcase_07 AC 190 ms
8,752 KB
testcase_08 AC 334 ms
10,324 KB
testcase_09 AC 356 ms
9,308 KB
testcase_10 AC 456 ms
10,312 KB
testcase_11 AC 480 ms
10,340 KB
testcase_12 AC 226 ms
8,728 KB
testcase_13 AC 222 ms
8,736 KB
testcase_14 AC 332 ms
9,396 KB
testcase_15 AC 178 ms
8,368 KB
testcase_16 AC 145 ms
8,544 KB
testcase_17 AC 392 ms
9,600 KB
testcase_18 AC 309 ms
9,108 KB
testcase_19 AC 376 ms
10,492 KB
testcase_20 AC 240 ms
8,576 KB
testcase_21 AC 219 ms
8,764 KB
testcase_22 AC 282 ms
9,852 KB
testcase_23 AC 169 ms
8,404 KB
testcase_24 AC 267 ms
9,264 KB
testcase_25 AC 206 ms
8,780 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:34: 警告: built-in function ‘pow’ declared as non-function [-Wbuiltin-declaration-mismatch]
    6 | ll K[300010],L[300010],D[300010],pow[60] = {1};
      |                                  ^~~

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;

int N;
ll K[300010],L[300010],D[300010],pow[60] = {1};

int main(){
    cin >> N;
    for(int i=1;i<=N;i++){
        cin >> K[i] >> L[i] >> D[i];
    }
    for(int i=1;i<60;i++) pow[i] = 2*pow[i-1];
    ll l = -1,r = 2e18;
    while(l+1<r){
        ll m = (l+r)/2;
        ll cnt = 0;
        for(int i=1;i<=N;i++){
            if(m>=L[i]) (cnt += min((m-L[i])/pow[D[i]]+1,K[i]))%=2;
        }
        if(cnt%2==1) r = m;
        else l = m;
    }
    cout << r << endl;
}
0