結果

問題 No.2962 Sum Bomb Bomber
ユーザー addeight2
提出日時 2024-12-28 20:35:37
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 965 bytes
コンパイル時間 11,282 ms
コンパイル使用メモリ 312,744 KB
実行使用メモリ 25,208 KB
平均クエリ数 111.34
最終ジャッジ日時 2024-12-28 20:36:04
合計ジャッジ時間 21,908 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define FOR(i, a, b) for(ll i = (a); i < (b); i++)
#define REP(i, a) FOR(i, 0, a)

using namespace std;
using ll = long long;

ll search(ll dir){
    ll lb = -100000000 - 1, ub = 100000000 + 1;
    while (ub - lb > 2) {
        ll m = floor((double)(lb + ub) / 2.0);
        ll ret0, ret1;
        if (dir == 0) {
            cout << format("1 {} {}", m, 0) << endl;
            cin >> ret0;
            cout << format("1 {} {}", m + 1, 0) << endl;
            cin >> ret1;
        } else {
            cout << format("1 {} {}", 0, m) << endl;
            cin >> ret0;
            cout << format("1 {} {}", 0, m + 1) << endl;
            cin >> ret1;
        }
        if (ret0 <= ret1) {
            ub = m + 1;
        } else {
            lb = m;
        }
    }
    return lb + 1;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll N;
    cin >> N;
    cout << format("2 {} {}", search(0), search(1)) << endl;
}
0