結果

問題 No.850 企業コンテスト2位
ユーザー ei1333333ei1333333
提出日時 2019-07-05 22:54:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,772 bytes
コンパイル時間 1,984 ms
コンパイル使用メモリ 204,520 KB
実行使用メモリ 24,432 KB
平均クエリ数 3116.93
最終ジャッジ日時 2023-09-23 17:36:14
合計ジャッジ時間 8,011 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,892 KB
testcase_01 AC 23 ms
24,000 KB
testcase_02 AC 24 ms
23,928 KB
testcase_03 AC 24 ms
23,568 KB
testcase_04 AC 23 ms
24,240 KB
testcase_05 AC 23 ms
23,316 KB
testcase_06 AC 22 ms
23,928 KB
testcase_07 AC 32 ms
23,592 KB
testcase_08 AC 30 ms
23,988 KB
testcase_09 AC 33 ms
23,616 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 22 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}


int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  iota(begin(A), end(A), 1);

  nth_element(begin(A), begin(A) + 1, end(A), [](int a, int b) {
    cout << "? " << a << " " << b << endl;
    int z;
    cin >> z;
    return z == a;
  });
  cout << "! " << A[1] << endl;
}


0