結果

問題 No.5003 物理好きクリッカー
ユーザー とばり
提出日時 2018-12-06 08:56:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 313 ms / 10,000 ms
コード長 1,181 bytes
コンパイル時間 2,167 ms
実行使用メモリ 21,972 KB
スコア 5,566,232
平均クエリ数 10000.00
最終ジャッジ日時 2021-07-19 08:55:38
合計ジャッジ時間 14,608 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

// #define DEBUG

enum Action
{
    CLICK,
    ENHCLICK
};

const int64_t inf = (1LL << 50);

int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    int n;
    std::cin >> n;

    std::string s;
    std::cin >> s;

    int levelClick = 0;
    int costClick = 15;
    int64_t score = 0;

    std::vector<Action> ans;

    for (int i = 0; i < n; i++)
    {
        int64_t score1 = score + (n - i) * (1LL << levelClick),
                score2 = score - costClick + (n - i - 1) * (1LL << (levelClick + 1));

        if (score < costClick or score1 > score2)
        {
            ans.push_back(CLICK);
            score += (1LL << levelClick);
        }
        else
        {
            ans.push_back(ENHCLICK);
            score -= costClick;
            levelClick++;
            costClick *= 10;
        }
    }

    for (int i = 0; i < n; i++)
    {
        if (ans[i] == ENHCLICK) std::cout << "enhclick" << std::endl;
        else std::cout << "click" << std::endl;

        std::string response;
        std::cin >> response;
    }

#ifdef DEBUG
    std::cerr << "[Score] " << score << std::endl;
#endif

    return 0;
}
0