結果

問題 No.814 ジジ抜き
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2019-04-13 16:52:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 3,000 ms
コード長 1,926 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 164,700 KB
実行使用メモリ 10,396 KB
最終ジャッジ日時 2023-10-13 14:25:34
合計ジャッジ時間 7,687 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,380 KB
testcase_01 AC 2 ms
7,612 KB
testcase_02 AC 2 ms
7,532 KB
testcase_03 AC 5 ms
7,412 KB
testcase_04 AC 299 ms
10,336 KB
testcase_05 AC 299 ms
10,388 KB
testcase_06 AC 301 ms
10,396 KB
testcase_07 AC 94 ms
8,640 KB
testcase_08 AC 144 ms
10,300 KB
testcase_09 AC 219 ms
9,340 KB
testcase_10 AC 282 ms
10,272 KB
testcase_11 AC 296 ms
10,324 KB
testcase_12 AC 139 ms
8,608 KB
testcase_13 AC 128 ms
8,596 KB
testcase_14 AC 202 ms
9,504 KB
testcase_15 AC 108 ms
8,280 KB
testcase_16 AC 74 ms
8,484 KB
testcase_17 AC 241 ms
9,908 KB
testcase_18 AC 189 ms
9,220 KB
testcase_19 AC 196 ms
10,348 KB
testcase_20 AC 150 ms
8,636 KB
testcase_21 AC 116 ms
8,788 KB
testcase_22 AC 127 ms
9,728 KB
testcase_23 AC 97 ms
8,512 KB
testcase_24 AC 112 ms
9,584 KB
testcase_25 AC 97 ms
8,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/








int N; ll K[301010], L[301010], D[301010];
ll p[101];
//---------------------------------------------------------------------------------------------------
int check(ll x) {
	__int128 sm = 0;
	rep(i, 0, N) {
		if (x < L[i]) continue;
		ll n = (x - L[i]) / p[D[i]] + 1;
		ll x = max(0LL, n);
		x = min(x, K[i]);
		sm += x;
	}
	return sm % 2 == 1;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	p[0] = 1;
	rep(i, 1, 101) p[i] = p[i - 1] * 2;

	cin >> N;
	rep(i, 0, N) cin >> K[i] >> L[i] >> D[i];

	ll ng = -1, ok = infl;
	while (ng + 1 != ok) {
		ll md = (ng + ok) / 2;
		if (check(md)) ok = md;
		else ng = md;
	}
	cout << ok << endl;
}
0