結果
問題 | No.814 ジジ抜き |
ユーザー | risujiroh |
提出日時 | 2019-04-12 22:18:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 143 ms / 3,000 ms |
コード長 | 748 bytes |
コンパイル時間 | 2,366 ms |
コンパイル使用メモリ | 170,912 KB |
実行使用メモリ | 10,360 KB |
最終ジャッジ日時 | 2024-09-14 19:55:00 |
合計ジャッジ時間 | 5,564 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; using lint = long long; template<class T = int> using V = vector<T>; template<class T = int> using VV = V< V<T> >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; V<lint> k(n), l(n), d(n); for (int i = 0; i < n; ++i) cin >> k[i] >> l[i] >> d[i]; auto chk = [&](lint x) -> bool { lint s = 0; for (int i = 0; i < n; ++i) { s += max(min(l[i] + (k[i] << d[i]), x + 1) - l[i], 0LL) + ~(~0LL << d[i]) >> d[i]; } return s & 1; }; for (int i = 1; i <= 10; ++i) { cerr << i << ' ' << chk(i) << '\n'; } lint ng = -1, ok = 1e18; while (ok - ng > 1) { lint mid = ng + ok >> 1; (chk(mid) ? ok : ng) = mid; } cout << ok << '\n'; }