結果

問題 No.1115 二つの数列 / Two Sequences
ユーザー paruf4paruf4
提出日時 2020-07-18 10:30:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 981 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 104,336 KB
最終ジャッジ日時 2023-08-20 17:12:13
合計ジャッジ時間 12,397 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
78,160 KB
testcase_01 AC 75 ms
71,644 KB
testcase_02 AC 76 ms
71,320 KB
testcase_03 AC 491 ms
100,620 KB
testcase_04 AC 608 ms
104,012 KB
testcase_05 AC 489 ms
100,112 KB
testcase_06 AC 429 ms
97,376 KB
testcase_07 AC 598 ms
104,256 KB
testcase_08 AC 94 ms
77,612 KB
testcase_09 AC 401 ms
101,660 KB
testcase_10 AC 981 ms
103,960 KB
testcase_11 AC 76 ms
71,464 KB
testcase_12 AC 622 ms
104,336 KB
testcase_13 AC 618 ms
104,064 KB
testcase_14 AC 622 ms
103,972 KB
testcase_15 AC 76 ms
71,236 KB
testcase_16 AC 76 ms
71,452 KB
testcase_17 AC 75 ms
71,464 KB
testcase_18 AC 75 ms
71,344 KB
testcase_19 AC 74 ms
71,344 KB
testcase_20 AC 75 ms
71,104 KB
testcase_21 AC 74 ms
71,468 KB
testcase_22 AC 75 ms
71,376 KB
testcase_23 AC 108 ms
78,108 KB
testcase_24 AC 187 ms
87,956 KB
testcase_25 AC 401 ms
97,884 KB
testcase_26 AC 128 ms
80,812 KB
testcase_27 AC 222 ms
93,032 KB
testcase_28 AC 313 ms
102,000 KB
testcase_29 AC 434 ms
97,388 KB
testcase_30 AC 571 ms
103,920 KB
testcase_31 AC 143 ms
82,740 KB
testcase_32 AC 121 ms
79,416 KB
testcase_33 AC 156 ms
100,344 KB
testcase_34 AC 76 ms
71,576 KB
testcase_35 AC 76 ms
71,456 KB
testcase_36 AC 76 ms
71,420 KB
testcase_37 AC 76 ms
71,368 KB
testcase_38 AC 76 ms
71,188 KB
testcase_39 AC 75 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right,insort_right
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
dic = {}
for i in range(N):
  dic[B[i]] = i
for i in range(N):
  A[i] = dic[A[i]]
lis = [A[0]]
ans=0
for i in range(1,N):
  idx = bisect_right(lis,A[i])
  ans += i-idx
  insort_right(lis,A[i])
print(ans)
0