結果

問題 No.814 ジジ抜き
ユーザー sinsincoscos
提出日時 2019-04-13 15:10:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 510 ms / 3,000 ms
コード長 536 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 64,384 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2024-09-15 11:08:01
合計ジャッジ時間 9,786 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:34: warning: 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