結果

問題 No.1115 二つの数列 / Two Sequences
ユーザー marroncastlemarroncastle
提出日時 2020-07-17 21:43:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 992 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 86,484 KB
実行使用メモリ 103,908 KB
最終ジャッジ日時 2023-08-20 00:21:48
合計ジャッジ時間 12,412 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
77,668 KB
testcase_01 AC 68 ms
71,216 KB
testcase_02 AC 68 ms
71,288 KB
testcase_03 AC 478 ms
99,748 KB
testcase_04 AC 594 ms
103,660 KB
testcase_05 AC 492 ms
99,656 KB
testcase_06 AC 417 ms
97,060 KB
testcase_07 AC 593 ms
103,908 KB
testcase_08 AC 85 ms
76,352 KB
testcase_09 AC 386 ms
101,052 KB
testcase_10 AC 992 ms
103,668 KB
testcase_11 AC 71 ms
71,052 KB
testcase_12 AC 604 ms
103,772 KB
testcase_13 AC 604 ms
103,776 KB
testcase_14 AC 614 ms
103,652 KB
testcase_15 AC 70 ms
70,820 KB
testcase_16 AC 70 ms
71,156 KB
testcase_17 AC 69 ms
71,156 KB
testcase_18 AC 68 ms
70,936 KB
testcase_19 AC 69 ms
70,984 KB
testcase_20 AC 67 ms
70,956 KB
testcase_21 AC 68 ms
71,212 KB
testcase_22 AC 69 ms
70,976 KB
testcase_23 AC 98 ms
77,540 KB
testcase_24 AC 174 ms
87,464 KB
testcase_25 AC 385 ms
97,012 KB
testcase_26 AC 116 ms
80,480 KB
testcase_27 AC 211 ms
92,692 KB
testcase_28 AC 297 ms
101,500 KB
testcase_29 AC 418 ms
96,832 KB
testcase_30 AC 554 ms
103,328 KB
testcase_31 AC 132 ms
82,384 KB
testcase_32 AC 111 ms
79,244 KB
testcase_33 AC 138 ms
99,808 KB
testcase_34 AC 69 ms
71,220 KB
testcase_35 AC 68 ms
70,820 KB
testcase_36 AC 68 ms
71,120 KB
testcase_37 AC 68 ms
70,948 KB
testcase_38 AC 69 ms
71,016 KB
testcase_39 AC 68 ms
71,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *
def solve():
  ans = 0
  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]]
  for i in range(1,N):
    ind = bisect_right(lis,A[i])
    ans += i-ind
    insort_right(lis,A[i])
  return ans
print(solve())
0