結果
問題 |
No.814 ジジ抜き
|
ユーザー |
![]() |
提出日時 | 2019-04-12 23:20:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 216 ms / 3,000 ms |
コード長 | 907 bytes |
コンパイル時間 | 2,158 ms |
コンパイル使用メモリ | 194,832 KB |
最終ジャッジ日時 | 2025-01-07 02:04:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#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; }