結果

問題 No.814 ジジ抜き
ユーザー leaf_1415leaf_1415
提出日時 2019-04-16 03:30:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 307 ms / 3,000 ms
コード長 617 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 56,404 KB
実行使用メモリ 10,652 KB
最終ジャッジ日時 2023-10-22 06:56:05
合計ジャッジ時間 6,571 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,716 KB
testcase_01 AC 2 ms
7,716 KB
testcase_02 AC 2 ms
7,716 KB
testcase_03 AC 5 ms
7,744 KB
testcase_04 AC 307 ms
10,652 KB
testcase_05 AC 306 ms
10,652 KB
testcase_06 AC 302 ms
10,612 KB
testcase_07 AC 94 ms
10,436 KB
testcase_08 AC 147 ms
10,564 KB
testcase_09 AC 219 ms
10,436 KB
testcase_10 AC 285 ms
10,536 KB
testcase_11 AC 297 ms
10,564 KB
testcase_12 AC 136 ms
10,436 KB
testcase_13 AC 133 ms
10,436 KB
testcase_14 AC 197 ms
10,436 KB
testcase_15 AC 108 ms
10,436 KB
testcase_16 AC 73 ms
10,436 KB
testcase_17 AC 242 ms
10,436 KB
testcase_18 AC 188 ms
10,436 KB
testcase_19 AC 201 ms
10,572 KB
testcase_20 AC 151 ms
10,436 KB
testcase_21 AC 116 ms
10,436 KB
testcase_22 AC 131 ms
10,436 KB
testcase_23 AC 96 ms
10,436 KB
testcase_24 AC 139 ms
10,436 KB
testcase_25 AC 99 ms
10,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#define llint long long

using namespace std;

llint n;
llint k[300005], l[300005], d[300005];

bool check(llint x)
{
	llint ret = 0;
	for(int i = 1; i <= n; i++){
		if(x-l[i] < 0) continue;
		llint cnt = (x-l[i])/(1LL<<d[i])+1;
		if(cnt < 0) cnt = 0;
		if(cnt > k[i]) cnt = k[i];
		ret += cnt;
	}
	return ret % 2;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> k[i] >> l[i] >> d[i];
	
	llint ub = 1e18+5, lb = -1, mid;
	while(ub-lb>1){
		mid=(ub+lb)/2;
		if(check(mid)) ub = mid;
		else lb = mid;
	}
	cout << ub << endl;
	
	return 0;
}
0