結果

問題 No.1282 Display Elements
ユーザー c-yanc-yan
提出日時 2020-11-07 00:03:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 24,632 KB
最終ジャッジ日時 2023-09-29 19:47:22
合計ジャッジ時間 7,109 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,976 KB
testcase_01 AC 16 ms
8,076 KB
testcase_02 WA -
testcase_03 AC 16 ms
8,060 KB
testcase_04 AC 16 ms
8,060 KB
testcase_05 WA -
testcase_06 AC 16 ms
7,924 KB
testcase_07 AC 16 ms
8,016 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 22 ms
8,376 KB
testcase_11 AC 22 ms
8,364 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 714 ms
24,632 KB
testcase_20 AC 693 ms
23,236 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left

N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a.sort()
t0 = []
t1 = []
result = 0
for i in range(N):
    i = bisect_left(t1, b[i])
    t1 = t1[:i] + [b[i]] + t1[i:]
    result += bisect_left(t0, a[i])
    result += bisect_left(t1, a[i])
    if len(t1) == 1000:
        t0.extend(t1)
        t0.sort()
        t1 = []
print(result)
0