結果

問題 No.814 ジジ抜き
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2019-04-13 16:48:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,921 bytes
コンパイル時間 1,448 ms
コンパイル使用メモリ 165,088 KB
実行使用メモリ 10,544 KB
最終ジャッジ日時 2023-10-13 14:25:26
合計ジャッジ時間 7,565 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,532 KB
testcase_01 AC 3 ms
7,424 KB
testcase_02 AC 2 ms
7,424 KB
testcase_03 AC 5 ms
7,520 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 287 ms
10,544 KB
testcase_07 AC 91 ms
8,612 KB
testcase_08 AC 142 ms
10,396 KB
testcase_09 AC 207 ms
9,296 KB
testcase_10 AC 266 ms
10,348 KB
testcase_11 AC 277 ms
10,500 KB
testcase_12 AC 132 ms
8,684 KB
testcase_13 AC 123 ms
8,656 KB
testcase_14 AC 194 ms
9,444 KB
testcase_15 AC 103 ms
8,472 KB
testcase_16 AC 73 ms
8,348 KB
testcase_17 AC 229 ms
9,756 KB
testcase_18 AC 182 ms
9,164 KB
testcase_19 AC 193 ms
10,340 KB
testcase_20 AC 143 ms
8,688 KB
testcase_21 AC 113 ms
8,788 KB
testcase_22 AC 123 ms
9,736 KB
testcase_23 AC 92 ms
8,368 KB
testcase_24 AC 107 ms
9,424 KB
testcase_25 AC 95 ms
8,912 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;
	}
	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