結果

問題 No.850 企業コンテスト2位
ユーザー noisy_noiminnoisy_noimin
提出日時 2019-07-05 23:23:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,197 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 93,112 KB
実行使用メモリ 24,324 KB
平均クエリ数 263.71
最終ジャッジ日時 2023-09-23 17:41:43
合計ジャッジ時間 4,469 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,700 KB
testcase_01 AC 27 ms
23,136 KB
testcase_02 AC 26 ms
23,532 KB
testcase_03 AC 26 ms
23,520 KB
testcase_04 AC 25 ms
23,568 KB
testcase_05 AC 26 ms
24,168 KB
testcase_06 AC 26 ms
23,400 KB
testcase_07 AC 31 ms
23,964 KB
testcase_08 AC 32 ms
23,292 KB
testcase_09 AC 31 ms
24,120 KB
testcase_10 AC 36 ms
23,964 KB
testcase_11 AC 35 ms
23,292 KB
testcase_12 AC 37 ms
23,520 KB
testcase_13 AC 36 ms
23,892 KB
testcase_14 AC 36 ms
23,448 KB
testcase_15 AC 35 ms
23,904 KB
testcase_16 AC 35 ms
24,192 KB
testcase_17 AC 36 ms
23,496 KB
testcase_18 AC 36 ms
23,256 KB
testcase_19 AC 36 ms
23,952 KB
testcase_20 WA -
testcase_21 AC 36 ms
23,568 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 26 ms
23,916 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, winner;
    cin >> n;
    vector<int> v(2, -1);
    cout << "? 1 2" << endl;
    cin >> winner;
    if(winner == 1) {
        v[0] = 1;
        v[1] = 2;
    } else {
        v[0] = 2;
        v[1] = 1;
    }
    int cnt = 0;
    for(int i=3;i<=n;++i) {
        cout << "? " << v[1] << ' ' << i << endl;
        cin >> winner;
        if(winner == v[1]) {
            continue;
        }
        cout << "? " << v[0] << ' ' << i << endl;
        cin >> winner;
        if(winner == v[0]) {
            v[1] = i;
        } else {
            v[1] = v[0];
            v[0] = i;
        }
    }

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