結果
問題 |
No.814 ジジ抜き
|
ユーザー |
|
提出日時 | 2019-04-12 23:26:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 321 ms / 3,000 ms |
コード長 | 652 bytes |
コンパイル時間 | 1,715 ms |
コンパイル使用メモリ | 168,716 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2024-09-15 06:19:52 |
合計ジャッジ時間 | 7,436 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<ll> K(n), L(n), D(n); for (int i = 0; i < n; i++) { cin >> K[i] >> L[i] >> D[i]; } ll ok = 1000000000000000000LL, ng = -1; while (ok - ng > 1) { ll mid = (ok + ng) / 2; ll cnt = 0; for (int i = 0; i < n; i++) { if (mid < L[i]) continue; (cnt += min((mid - L[i]) / (1LL << D[i]) + 1, K[i]) % 2) %= 2; } if (cnt == 0) ng = mid; else ok = mid; } cout << ok << endl; return 0; }