結果

問題 No.2085 Directed Complete Graph
ユーザー noshi91noshi91
提出日時 2022-09-26 22:23:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 204,504 KB
実行使用メモリ 24,456 KB
平均クエリ数 2807.59
最終ジャッジ日時 2023-08-24 03:11:56
合計ジャッジ時間 5,326 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,772 KB
testcase_01 AC 24 ms
24,300 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 89 ms
23,628 KB
testcase_06 AC 95 ms
23,412 KB
testcase_07 AC 160 ms
23,520 KB
testcase_08 AC 124 ms
23,628 KB
testcase_09 AC 153 ms
23,580 KB
testcase_10 AC 162 ms
24,084 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 23 ms
23,820 KB
testcase_16 AC 23 ms
23,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  int N;
  std::cin >> N;
  auto comp = [](int i, int j) {
    if (i == j) {
      return false;
    }
    std::cout << "? " << i << " " << j << "\n";
    int T;
    std::cin >> T;
    return T == 1;
  };

  std::vector<int> v(N);
  std::iota(v.begin(), v.end(), 1);
  std::sort(v.begin(), v.end(), comp);
  std::cout << "!\n" << N - 1 << "\n";
  for (int i = 0; i < N; i++) {
    std::cout << v[i] << " \n"[i + 1 == N];
  }
}
0