結果
問題 |
No.8109 GCD between Permutations
|
ユーザー |
|
提出日時 | 2024-03-04 21:49:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 618 bytes |
コンパイル時間 | 4,272 ms |
コンパイル使用メモリ | 249,972 KB |
最終ジャッジ日時 | 2025-02-20 00:48:43 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 28 |
ソースコード
#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; }