結果

問題 No.3726 Flawless Flow
コンテスト
ユーザー cho435
提出日時 2026-09-19 17:45:59
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,103 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,928 ms
コンパイル使用メモリ 339,708 KB
実行使用メモリ 10,032 KB
最終ジャッジ日時 2026-09-19 17:46:15
合計ジャッジ時間 5,518 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 48 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <class T> bool chmin(T& x, T y) {
	return x > y ? (x = y, true) : false;
}
template <class T> bool chmax(T& x, T y) {
	return x < y ? (x = y, true) : false;
}

void solve() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	rep(i, 0, n) cin >> a[i], a[i]--;
	rep(i, 0, n) cin >> b[i], b[i]--;
	vector<int> p(n);
	rep(i, 0, n) p[b[i]] = i;

	rep(i, 0, n) cout << a[i] + 1 << ' ';
	cout << '\n';
	rep(lp, 0, n) {
		rep(i, 0, n - 1) {
			if (p[a[i]] > p[a[i + 1]]) {
				swap(a[i], a[i + 1]);
				i++;
			}
		}
		rep(i, 0, n) cout << a[i] + 1 << ' ';
		cout << '\n';
	}
	return;

	vector<vector<int>> ans(n, vector<int>(n, 0));

	rep(i, 0, n) ans[i][n - 1 - i] = 1;
	rep(i, 0, n - 1) ans[i + 1][n - 1 - i] = 1;

	rep(i, 0, n) {
		rep(j, 0, n) cout << (ans[i][j] ? '#' : '.');
		cout << '\n';
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(15);
	int t = 1;
	// cin >> t;
	while (t--) solve();
}
0