結果

問題 No.814 ジジ抜き
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2019-04-13 16:53:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 297 ms / 3,000 ms
コード長 1,924 bytes
コンパイル時間 1,427 ms
コンパイル使用メモリ 165,204 KB
実行使用メモリ 10,556 KB
最終ジャッジ日時 2023-10-13 14:25:43
合計ジャッジ時間 7,381 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,444 KB
testcase_01 AC 2 ms
7,664 KB
testcase_02 AC 2 ms
7,460 KB
testcase_03 AC 5 ms
7,464 KB
testcase_04 AC 297 ms
10,384 KB
testcase_05 AC 294 ms
10,344 KB
testcase_06 AC 295 ms
10,556 KB
testcase_07 AC 91 ms
8,564 KB
testcase_08 AC 138 ms
10,256 KB
testcase_09 AC 214 ms
9,360 KB
testcase_10 AC 269 ms
10,220 KB
testcase_11 AC 286 ms
10,256 KB
testcase_12 AC 137 ms
8,556 KB
testcase_13 AC 125 ms
8,536 KB
testcase_14 AC 196 ms
9,716 KB
testcase_15 AC 107 ms
8,284 KB
testcase_16 AC 73 ms
8,372 KB
testcase_17 AC 234 ms
9,720 KB
testcase_18 AC 184 ms
9,220 KB
testcase_19 AC 192 ms
10,264 KB
testcase_20 AC 143 ms
8,536 KB
testcase_21 AC 114 ms
8,692 KB
testcase_22 AC 123 ms
9,792 KB
testcase_23 AC 95 ms
8,552 KB
testcase_24 AC 106 ms
9,348 KB
testcase_25 AC 95 ms
8,768 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) {
	ll 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 % 2;
	}
	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