結果

問題 No.814 ジジ抜き
ユーザー TiramisterTiramister
提出日時 2019-04-12 23:43:48
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 493 ms / 3,000 ms
コード長 628 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 68,816 KB
実行使用メモリ 10,024 KB
最終ジャッジ日時 2023-10-13 09:15:04
合計ジャッジ時間 9,380 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,368 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 6 ms
4,352 KB
testcase_04 AC 493 ms
9,940 KB
testcase_05 AC 492 ms
10,024 KB
testcase_06 AC 483 ms
9,972 KB
testcase_07 AC 187 ms
6,668 KB
testcase_08 AC 326 ms
9,748 KB
testcase_09 AC 353 ms
8,000 KB
testcase_10 AC 453 ms
9,704 KB
testcase_11 AC 480 ms
9,776 KB
testcase_12 AC 232 ms
6,396 KB
testcase_13 AC 218 ms
6,500 KB
testcase_14 AC 336 ms
8,308 KB
testcase_15 AC 179 ms
5,660 KB
testcase_16 AC 148 ms
5,700 KB
testcase_17 AC 390 ms
8,372 KB
testcase_18 AC 311 ms
7,816 KB
testcase_19 AC 371 ms
9,864 KB
testcase_20 AC 241 ms
6,532 KB
testcase_21 AC 219 ms
6,860 KB
testcase_22 AC 274 ms
8,652 KB
testcase_23 AC 173 ms
5,816 KB
testcase_24 AC 244 ms
8,048 KB
testcase_25 AC 203 ms
6,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using lint = long long;

struct Card {
    lint K, L;
    int D;
};

int main() {
    int N;
    std::cin >> N;

    std::vector<Card> cards(N);
    for (auto& c : cards) {
        std::cin >> c.K >> c.L >> c.D;
    }

    lint ok = 1LL << 60, ng = -1;
    while (ok - ng > 1) {
        lint mid = (ok + ng) / 2;
        lint num = 0;
        for (auto card : cards) {
            if (mid < card.L) continue;
            num += std::min((mid - card.L) / (1LL << card.D) + 1, card.K);
        }

        ((num & 1) ? ok : ng) = mid;
    }

    std::cout << ok << std::endl;
    return 0;
}
0