結果

問題 No.2085 Directed Complete Graph
ユーザー noshi91noshi91
提出日時 2022-09-26 22:43:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 2,340 ms
コンパイル使用メモリ 211,652 KB
実行使用メモリ 25,476 KB
平均クエリ数 2467.06
最終ジャッジ日時 2024-06-02 00:28:00
合計ジャッジ時間 4,887 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
25,476 KB
testcase_01 AC 20 ms
24,580 KB
testcase_02 WA -
testcase_03 AC 143 ms
25,196 KB
testcase_04 WA -
testcase_05 AC 71 ms
25,040 KB
testcase_06 AC 72 ms
24,940 KB
testcase_07 AC 130 ms
24,812 KB
testcase_08 AC 98 ms
25,196 KB
testcase_09 AC 126 ms
24,556 KB
testcase_10 AC 131 ms
24,940 KB
testcase_11 AC 130 ms
25,196 KB
testcase_12 AC 131 ms
24,928 KB
testcase_13 AC 134 ms
25,196 KB
testcase_14 AC 134 ms
24,812 KB
testcase_15 AC 21 ms
24,964 KB
testcase_16 AC 20 ms
24,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  int N;
  std::cin >> N;
  struct id {
    int v;
    id &operator=(const id &x) {
      v = x.v;
      return *this;
    }
  };
  auto comp = [&](id i, id j) {
    if (i.v == j.v) {
      return false;
    }
    std::cout << "? " << i.v << " " << j.v << "\n";
    int T;
    std::cin >> T;
    return T == 1;
  };

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