結果

問題 No.850 企業コンテスト2位
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-07-05 23:38:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 77,864 KB
実行使用メモリ 24,348 KB
平均クエリ数 3116.93
最終ジャッジ日時 2023-09-23 17:44:20
合計ジャッジ時間 6,916 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
23,880 KB
testcase_01 AC 24 ms
23,364 KB
testcase_02 AC 23 ms
23,712 KB
testcase_03 AC 24 ms
23,328 KB
testcase_04 AC 24 ms
23,376 KB
testcase_05 AC 24 ms
23,328 KB
testcase_06 AC 23 ms
23,904 KB
testcase_07 AC 33 ms
23,388 KB
testcase_08 AC 32 ms
23,700 KB
testcase_09 AC 33 ms
23,916 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 RE -
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 AC 25 ms
23,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  iota(a.begin(), a.end(), 1);
  nth_element(a.begin(), a.begin() + 1, a.end(), [](const int a, const int b) {
    cout << "? " << a << " " << b << endl;
    int res;
    cin >> res;
    return (res == a);
  });
  cout << "! " << a[1] << endl;
  return 0;
}
0