結果
| 問題 | No.3726 Flawless Flow |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 16:01:59 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 57 ms / 2,000 ms |
| + 574µs | |
| コード長 | 1,270 bytes |
| 記録 | |
| コンパイル時間 | 71 ms |
| コンパイル使用メモリ | 81,592 KB |
| 実行使用メモリ | 90,112 KB |
| 最終ジャッジ日時 | 2026-09-19 16:02:06 |
| 合計ジャッジ時間 | 6,183 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 59 |
ソースコード
# https://github.com/tyuyu-62/cp-library
from collections import deque, defaultdict
from itertools import permutations, product
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop
from random import randint, shuffle
from time import perf_counter as pc
def II(): return int(input())
def LI(dec=0): return [int(x) - dec for x in input().split()]
def SI(): return input()
def LS(): return list(input().split())
mod = 998244353
inf = 2002002002002002002
import sys
sys.setrecursionlimit(10 ** 6)
input = lambda: sys.stdin.readline().rstrip()
_buf = []
def print(*args, sep=" "): _buf.append(sep.join(map(str, args)))
def debug(*args):
if DEBUG: sys.stdout.write(" ".join(map(str, args)) + "\n")
DEBUG = True
def solve():
N = II()
A = LI()
B = LI()
S = [A[:]]
idx = [0] * (N + 1)
for i in range(N):
idx[B[i]] = i
for i in range(N):
f = i & 1
for j in range(f, N - 1, 2):
if idx[A[j]] > idx[A[j + 1]]:
A[j], A[j + 1] = A[j + 1], A[j]
f = 1
S.append(A[:])
for s in S:
print(*s)
return
if __name__ == "__main__":
T = 1
# T = II()
for _ in range(T):
solve()
sys.stdout.write("\n".join(_buf) + "\n")