結果
問題 |
No.1115 二つの数列 / Two Sequences
|
ユーザー |
![]() |
提出日時 | 2024-11-08 16:59:01 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 360 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 106,496 KB |
最終ジャッジ日時 | 2024-11-08 16:59:10 |
合計ジャッジ時間 | 5,771 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 5 |
other | RE * 35 |
ソースコード
N = int(input()) A = [0] + list(map(int,input().split())) B = [0] + list(map(int,input().split())) P = [0] * (N + 1) Q = [0] * (N + 1) for i in range(N + 1): P[A[i]] = i for i in range(N + 1): Q[i] = P[B[i]] from atcoder.fenwicktree import FenwickTree ft = FenwickTree(N + 1) cnt = 0 for x in Q: cnt += ft.sum(x, N + 1) ft.add(x, 1) print(cnt)