結果
| 問題 | No.3726 Flawless Flow |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 16:46:23 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 12 ms / 2,000 ms |
| + 322µs | |
| コード長 | 796 bytes |
| 記録 | |
| コンパイル時間 | 2,061 ms |
| コンパイル使用メモリ | 343,672 KB |
| 実行使用メモリ | 10,048 KB |
| 最終ジャッジ日時 | 2026-09-19 16:46:33 |
| 合計ジャッジ時間 | 5,710 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 59 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
mt19937 mt;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n), b(n);
rep(i, n) cin >> a[i];
rep(i, n) cin >> b[i];
vector<vector<bool>> v(n + 1, vector<bool>(n + 1));
rep(i, n) rep(j, n) {
if (i > j)
continue;
v[b[i]][b[j]] = true;
}
rep(i, n) cout << a[i] << " ";
cout << endl;
rep(i, n) {
set<int> st;
for (int j = i % 2; j < n - 1; j += 2) {
if (!v[a[j]][a[j + 1]]) {
swap(a[j], a[j + 1]);
}
}
rep(i, n) cout << a[i] << " ";
cout << endl;
}
return 0;
}