結果

問題 No.814 ジジ抜き
ユーザー beetbeet
提出日時 2019-04-12 23:20:03
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 205 ms / 3,000 ms
コード長 907 bytes
コンパイル時間 2,008 ms
コンパイル使用メモリ 200,416 KB
実行使用メモリ 10,236 KB
最終ジャッジ日時 2023-10-13 09:11:23
合計ジャッジ時間 6,511 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 138 ms
10,236 KB
testcase_05 AC 139 ms
10,180 KB
testcase_06 AC 161 ms
9,928 KB
testcase_07 AC 82 ms
6,504 KB
testcase_08 AC 134 ms
9,968 KB
testcase_09 AC 123 ms
8,036 KB
testcase_10 AC 205 ms
9,580 KB
testcase_11 AC 165 ms
9,892 KB
testcase_12 AC 91 ms
6,404 KB
testcase_13 AC 91 ms
6,524 KB
testcase_14 AC 148 ms
8,356 KB
testcase_15 AC 69 ms
5,672 KB
testcase_16 AC 61 ms
5,596 KB
testcase_17 AC 129 ms
8,656 KB
testcase_18 AC 137 ms
7,900 KB
testcase_19 AC 165 ms
9,760 KB
testcase_20 AC 90 ms
6,420 KB
testcase_21 AC 89 ms
7,140 KB
testcase_22 AC 115 ms
8,864 KB
testcase_23 AC 71 ms
5,864 KB
testcase_24 AC 110 ms
8,092 KB
testcase_25 AC 88 ms
7,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){  
  Int n;
  cin>>n;
  vector<Int> a(n),b(n),c(n);
  for(Int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];

  auto calc=
    [&](Int x)->Int{
      Int res=0;
      for(Int i=0;i<n;i++){
        if(x<=b[i]){
          res+=a[i];
          continue;
        }
        Int d=(x-b[i]);
        Int e=(d+(1LL<<c[i])-1)>>c[i];
        if(a[i]>e) res+=a[i]-e;
      }
      //cout<<x<<" "<<res<<endl;
      res&=1;
      return res;
    };
  
  Int l=0,r=1.1e18;
  while(l+1<r){
    Int m=(l+r)>>1;
    if(calc(m)) l=m;
    else r=m;
  }  
  cout<<l<<endl;
  return 0;
}
0