結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,408 KB
testcase_01 AC 25 ms
23,388 KB
testcase_02 WA -
testcase_03 AC 162 ms
23,664 KB
testcase_04 WA -
testcase_05 AC 82 ms
23,424 KB
testcase_06 AC 85 ms
24,072 KB
testcase_07 AC 144 ms
23,412 KB
testcase_08 AC 114 ms
23,856 KB
testcase_09 AC 142 ms
24,216 KB
testcase_10 AC 148 ms
24,060 KB
testcase_11 AC 151 ms
24,288 KB
testcase_12 AC 152 ms
24,060 KB
testcase_13 AC 150 ms
23,532 KB
testcase_14 AC 152 ms
24,348 KB
testcase_15 AC 25 ms
23,712 KB
testcase_16 AC 26 ms
23,436 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::stable_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