結果

問題 No.282 おもりと天秤(2)
ユーザー kk
提出日時 2021-03-23 14:00:51
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3,124 ms / 5,000 ms
コード長 795 bytes
コンパイル時間 2,068 ms
コンパイル使用メモリ 201,876 KB
実行使用メモリ 24,360 KB
平均クエリ数 440.67
最終ジャッジ日時 2023-09-24 02:53:59
合計ジャッジ時間 30,257 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
24,336 KB
testcase_01 AC 29 ms
23,436 KB
testcase_02 AC 26 ms
24,336 KB
testcase_03 AC 24 ms
23,676 KB
testcase_04 AC 23 ms
24,096 KB
testcase_05 AC 26 ms
24,360 KB
testcase_06 AC 38 ms
24,300 KB
testcase_07 AC 22 ms
24,012 KB
testcase_08 AC 32 ms
24,348 KB
testcase_09 AC 20 ms
23,472 KB
testcase_10 AC 762 ms
23,412 KB
testcase_11 AC 2,750 ms
24,012 KB
testcase_12 AC 926 ms
24,324 KB
testcase_13 AC 1,339 ms
23,484 KB
testcase_14 AC 2,420 ms
24,336 KB
testcase_15 AC 3,029 ms
23,712 KB
testcase_16 AC 198 ms
24,048 KB
testcase_17 AC 1,280 ms
23,736 KB
testcase_18 AC 2,162 ms
24,096 KB
testcase_19 AC 2,089 ms
23,436 KB
testcase_20 AC 3,076 ms
23,544 KB
testcase_21 AC 3,054 ms
23,460 KB
testcase_22 AC 3,124 ms
23,400 KB
testcase_23 AC 20 ms
24,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin >> n;

  vector<int> ret(n);
  for (int i = 0; i < n; i++)
    ret[i] = i + 1;

  for (int i = 0; i < 2 * n; i++) {
    cout << "?";
    int m = n;
    for (int j = i % 2; j + 1 < n; j += 2) {
      cout << " " << ret[j] << " " << ret[j+1];
      --m;
    }
    while (m--)
      cout << " " << 0 << " " << 0;
    cout << endl;
    cout.flush();
    
    m = n;
    for (int j = i % 2; j + 1 < n; j += 2) {
      char x;
      cin >> x;
      if (x == '>')
        swap(ret[j], ret[j+1]);
      --m;
    }
    while (m--) {
      char _;
      cin >> _;
    }
  }
  
  cout << "!";
  for (int x: ret)
    cout << " " << x;
  cout << endl;
  cout.flush();
  
  return 0;
}
0