結果

問題 No.850 企業コンテスト2位
ユーザー noisy_noiminnoisy_noimin
提出日時 2019-07-05 23:19:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,243 bytes
コンパイル時間 862 ms
コンパイル使用メモリ 94,056 KB
実行使用メモリ 24,468 KB
平均クエリ数 241.43
最終ジャッジ日時 2023-09-23 17:41:08
合計ジャッジ時間 8,932 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,640 KB
testcase_01 AC 24 ms
23,352 KB
testcase_02 AC 25 ms
24,240 KB
testcase_03 AC 23 ms
23,820 KB
testcase_04 AC 25 ms
23,496 KB
testcase_05 AC 24 ms
23,928 KB
testcase_06 AC 24 ms
23,940 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 23 ms
23,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    int n;
    cin >> n;
    vector<int> v(n, -1);
    v[0] = 1;
    int cnt = 0;
    for(int i=2;i<=n;++i) {
        int ng = -1, ok = i-1;
        while(ok-ng > 1) {
            int mid = (ng+ok)/2;
            cout << "? " << v[mid] << ' ' << i << endl;
            ++cnt;
            if(cnt > 334) assert(false);
            int winner = -1;
            cin >> winner;
            if(i == winner) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        int tmp = i, nxt = i;
        for(int j=ok;j<n;++j) {
            nxt = v[j];
            v[j] = tmp;
            tmp = nxt;
        }
    }

    cout << "! " << v[1] << endl;
}
0