結果

問題 No.814 ジジ抜き
ユーザー Lepton_sLepton_s
提出日時 2018-02-21 12:16:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 184 ms / 3,000 ms
コード長 614 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 75,484 KB
実行使用メモリ 8,860 KB
最終ジャッジ日時 2023-10-12 22:14:42
合計ジャッジ時間 5,110 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 119 ms
8,860 KB
testcase_05 AC 121 ms
8,808 KB
testcase_06 AC 142 ms
8,828 KB
testcase_07 AC 73 ms
6,052 KB
testcase_08 AC 125 ms
8,516 KB
testcase_09 AC 107 ms
7,304 KB
testcase_10 AC 184 ms
8,684 KB
testcase_11 AC 141 ms
8,584 KB
testcase_12 AC 83 ms
6,072 KB
testcase_13 AC 84 ms
5,888 KB
testcase_14 AC 133 ms
7,272 KB
testcase_15 AC 62 ms
5,088 KB
testcase_16 AC 56 ms
5,156 KB
testcase_17 AC 114 ms
7,480 KB
testcase_18 AC 123 ms
7,016 KB
testcase_19 AC 151 ms
8,624 KB
testcase_20 AC 80 ms
6,000 KB
testcase_21 AC 87 ms
6,252 KB
testcase_22 AC 109 ms
7,800 KB
testcase_23 AC 65 ms
5,416 KB
testcase_24 AC 105 ms
7,248 KB
testcase_25 AC 79 ms
6,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <vector>
typedef long long ll;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
using namespace std;

int main(){
	//std::ios::sync_with_stdio(false);std::cin.tie(0);
	int N;
	scanf("%d",&N);
	vector<ll> K(N), L(N);
	vector<int> D(N);
	rep(i, N) scanf("%lld%lld%d",&K[i],&L[i],&D[i]);
	ll lb = -1, ub = (ll)1e18+10;
	while(ub-lb>1){
		ll md = (lb+ub+1)/2;
		int x = 0;
		rep(i, N){
			ll t = md-L[i];
			if(t<0) continue;
			t >>= D[i];
			t = min(t, K[i]-1);
			if(t%2==0) x = !x;
		}
		(x==1?ub:lb)=md;
	}
	cout<<ub<<endl;
	return 0;
}
0