結果

問題 No.3109 GCD between Permutations
ユーザー KumaTachiRenKumaTachiRen
提出日時 2024-03-04 21:49:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 7,739 ms
コンパイル使用メモリ 262,592 KB
実行使用メモリ 24,012 KB
平均クエリ数 2.00
最終ジャッジ日時 2024-03-04 21:49:36
合計ジャッジ時間 8,274 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,012 KB
testcase_01 AC 23 ms
24,012 KB
testcase_02 AC 23 ms
24,012 KB
testcase_03 AC 23 ms
24,012 KB
testcase_04 AC 24 ms
24,012 KB
testcase_05 AC 23 ms
24,012 KB
testcase_06 AC 23 ms
24,012 KB
testcase_07 AC 24 ms
24,012 KB
testcase_08 AC 23 ms
24,012 KB
testcase_09 AC 22 ms
24,012 KB
testcase_10 AC 23 ms
24,012 KB
testcase_11 AC 26 ms
24,012 KB
testcase_12 AC 24 ms
24,012 KB
testcase_13 AC 23 ms
24,012 KB
testcase_14 AC 23 ms
24,012 KB
testcase_15 AC 24 ms
24,012 KB
testcase_16 AC 23 ms
24,012 KB
testcase_17 AC 24 ms
24,012 KB
testcase_18 AC 24 ms
24,012 KB
testcase_19 AC 23 ms
24,012 KB
testcase_20 AC 23 ms
24,012 KB
testcase_21 AC 23 ms
24,012 KB
testcase_22 AC 24 ms
24,012 KB
testcase_23 AC 25 ms
24,012 KB
testcase_24 AC 24 ms
24,012 KB
testcase_25 AC 23 ms
24,012 KB
testcase_26 AC 23 ms
24,000 KB
testcase_27 AC 24 ms
24,000 KB
testcase_28 AC 23 ms
24,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

struct Fast {
  Fast() {
    std::cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(10);
  }
} fast;

#define rep(i, a, b) for (int(i) = (a); (i) < (int)(b); (i)++)

int main() {
  int n;
  cin >> n;

  vector<int> a(n), b(n);
  rep(i, 0, n) a[i] = i + 1, b[i] = i + 1;

  cout << "? 1 1" << endl;
  int g;
  cin >> g;
  if (g != 1) {
    swap(a[0], a[g - 1]);
    swap(b[0], b[g - 1]);
  }

  cout << "!";
  rep(i, 0, n) cout << " " << a[i];
  rep(i, 0, n) cout << " " << b[i];
  cout << endl;
}
0