結果

問題 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,176 ms
コンパイル使用メモリ 207,596 KB
実行使用メモリ 24,492 KB
平均クエリ数 2467.06
最終ジャッジ日時 2023-08-24 03:14:23
合計ジャッジ時間 5,332 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,892 KB
testcase_01 AC 24 ms
23,616 KB
testcase_02 WA -
testcase_03 AC 158 ms
23,604 KB
testcase_04 WA -
testcase_05 AC 80 ms
24,048 KB
testcase_06 AC 84 ms
24,048 KB
testcase_07 AC 140 ms
23,628 KB
testcase_08 AC 111 ms
23,904 KB
testcase_09 AC 141 ms
23,628 KB
testcase_10 AC 146 ms
23,352 KB
testcase_11 AC 147 ms
24,408 KB
testcase_12 AC 147 ms
23,376 KB
testcase_13 AC 147 ms
23,832 KB
testcase_14 AC 148 ms
23,712 KB
testcase_15 AC 24 ms
23,436 KB
testcase_16 AC 23 ms
23,400 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