結果

問題 No.850 企業コンテスト2位
ユーザー 👑 hos.lyric
提出日時 2019-07-05 23:38:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 1,107 ms
コンパイル使用メモリ 77,548 KB
実行使用メモリ 25,604 KB
平均クエリ数 3116.93
最終ジャッジ日時 2024-07-16 17:37:59
合計ジャッジ時間 8,956 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 WA * 13 RE * 4
権限があれば一括ダウンロードができます

ソースコード

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