結果

問題 No.850 企業コンテスト2位
ユーザー ぷらぷら
提出日時 2023-11-29 10:59:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,413 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 144,304 KB
実行使用メモリ 24,012 KB
平均クエリ数 200.11
最終ジャッジ日時 2023-11-29 10:59:35
合計ジャッジ時間 4,916 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,012 KB
testcase_01 AC 24 ms
24,012 KB
testcase_02 AC 24 ms
24,012 KB
testcase_03 AC 23 ms
24,012 KB
testcase_04 AC 25 ms
24,012 KB
testcase_05 AC 24 ms
24,012 KB
testcase_06 AC 26 ms
24,012 KB
testcase_07 AC 29 ms
24,012 KB
testcase_08 AC 30 ms
24,012 KB
testcase_09 AC 30 ms
24,012 KB
testcase_10 AC 35 ms
24,012 KB
testcase_11 AC 34 ms
24,012 KB
testcase_12 AC 34 ms
24,012 KB
testcase_13 AC 34 ms
24,012 KB
testcase_14 AC 34 ms
24,012 KB
testcase_15 AC 33 ms
24,012 KB
testcase_16 AC 33 ms
24,012 KB
testcase_17 AC 35 ms
24,012 KB
testcase_18 AC 33 ms
24,012 KB
testcase_19 AC 35 ms
24,012 KB
testcase_20 AC 35 ms
24,012 KB
testcase_21 AC 35 ms
24,012 KB
testcase_22 AC 35 ms
24,012 KB
testcase_23 AC 34 ms
24,012 KB
testcase_24 AC 35 ms
24,012 KB
testcase_25 AC 36 ms
24,012 KB
testcase_26 AC 35 ms
24,012 KB
testcase_27 AC 25 ms
24,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<vector<int>>tmp(N);
    vector<int>now(N);
    iota(now.begin(),now.end(),0);
    while(now.size() > 1) {
        vector<int>nxt;
        for(int i = 0; i < now.size(); i += 2) {
            if(i+1 == now.size()) {
                nxt.push_back(now[i]);
            }
            else {
                cout << "? " << now[i]+1 << " " << now[i+1]+1 << endl;
                int a;
                cin >> a;
                nxt.push_back(a-1);
                tmp[a-1].push_back(now[i]^now[i+1]^(a-1));
            }
        }
        now = nxt;
    }
    int a = tmp[now[0]][0];
    for(int i = 1; i < tmp[now[0]].size(); i++) {
        cout << "? " << a+1 << " " << tmp[now[0]][i]+1 << endl;
        cin >> a;
        a--;
    }
    cout << "! " << a+1 << endl;
}
0