結果

問題 No.2962 Sum Bomb Bomber
ユーザー ldsyb
提出日時 2024-11-16 15:59:00
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 1,780 bytes
コンパイル時間 5,184 ms
コンパイル使用メモリ 308,004 KB
実行使用メモリ 25,592 KB
平均クエリ数 187.06
最終ジャッジ日時 2024-11-16 15:59:24
合計ジャッジ時間 14,734 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

int main()
{
    int64_t n;
    cin >> n;

    int64_t x = [&]
    {
        int64_t l = -100000001, r = 100000001;
        while (2 < abs(l - r))
        {
            int64_t ml = (2 * l + r) / 3;
            int64_t mr = (l + 2 * r) / 3;

            int64_t dl, dr;
            cout << 1 << ' ' << ml << ' ' << 0 << endl;
            cin >> dl;
            cout << 1 << ' ' << mr << ' ' << 0 << endl;
            cin >> dr;

            if (dl < dr)
            {
                r = mr;
            }
            else
            {
                l = ml;
            }
        }

        return l + 1;
    }();

    int64_t y = [&]
    {
        int64_t l = -100000001, r = 100000001;
        while (2 < abs(l - r))
        {
            int64_t ml = (2 * l + r) / 3;
            int64_t mr = (l + 2 * r) / 3;

            int64_t dl, dr;
            cout << 1 << ' ' << 0 << ' ' << ml << endl;
            cin >> dl;
            cout << 1 << ' ' << 0 << ' ' << mr << endl;
            cin >> dr;

            if (dl < dr)
            {
                r = mr;
            }
            else
            {
                l = ml;
            }
        }

        return l + 1;
    }();

    int64_t tmp = (1LL << 60);
    for (int64_t nx : {x, x + 1})
    {
        for (int64_t ny : {y, y + 1})
        {
            cout << 1 << ' ' << nx << ' ' << ny << endl;
            int64_t d;
            cin >> d;
            if (d < tmp)
            {
                x = nx;
                y = ny;
                tmp = d;
            }
        }
    }

    cout << 2 << ' ' << x << ' ' << y << endl;

    return 0;
}
0