結果

問題 No.282 おもりと天秤(2)
ユーザー k
提出日時 2021-03-23 14:00:51
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 3,754 ms / 5,000 ms
コード長 795 bytes
コンパイル時間 6,716 ms
コンパイル使用メモリ 256,484 KB
最終ジャッジ日時 2025-01-19 21:13:11
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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