結果

問題 No.850 企業コンテスト2位
ユーザー karinohitokarinohito
提出日時 2023-04-13 01:50:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 2,213 ms
コンパイル使用メモリ 203,300 KB
実行使用メモリ 25,476 KB
平均クエリ数 200.29
最終ジャッジ日時 2024-04-17 09:32:57
合計ジャッジ時間 4,777 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,w,p,q,x,t=2;
    cin>>N;
    vector<vector<int>> L(N);
    queue<int> Q;
    while(N--)Q.push(N);
    while(t--){
        while(Q.size()>1){
            p=Q.front();
            Q.pop();
            q=Q.front();
            Q.pop();
            cout<<"? "<<p+1<<" "<<q+1<<endl;
            cin>>x;
            x--;
            Q.push(x);
            L[x].push_back(p+q-x);
        }
        w=Q.front();
        Q.pop();
        for(auto v:L[w])Q.push(v);
    }
    cout<<"! "<<w+1<<endl;
}
0