結果

問題 No.1282 Display Elements
ユーザー c-yanc-yan
提出日時 2020-11-07 00:44:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 966 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 491 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 24,640 KB
最終ジャッジ日時 2023-09-29 19:53:27
合計ジャッジ時間 7,993 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,996 KB
testcase_01 AC 15 ms
7,908 KB
testcase_02 AC 16 ms
7,932 KB
testcase_03 AC 16 ms
7,956 KB
testcase_04 AC 15 ms
8,060 KB
testcase_05 AC 16 ms
8,020 KB
testcase_06 AC 17 ms
7,904 KB
testcase_07 AC 15 ms
7,956 KB
testcase_08 AC 15 ms
7,996 KB
testcase_09 AC 16 ms
7,956 KB
testcase_10 AC 18 ms
8,280 KB
testcase_11 AC 18 ms
7,980 KB
testcase_12 AC 16 ms
7,940 KB
testcase_13 AC 17 ms
7,944 KB
testcase_14 AC 19 ms
7,960 KB
testcase_15 AC 837 ms
22,128 KB
testcase_16 AC 225 ms
13,844 KB
testcase_17 AC 616 ms
19,568 KB
testcase_18 AC 311 ms
15,388 KB
testcase_19 AC 630 ms
24,640 KB
testcase_20 AC 781 ms
23,224 KB
testcase_21 AC 966 ms
22,964 KB
testcase_22 AC 911 ms
23,244 KB
testcase_23 AC 958 ms
23,140 KB
権限があれば一括ダウンロードができます

ソースコード

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):
    c = a[i]
    t1.append(b[i])
    result += bisect_left(t0, c)
    result += sum(1 for b in t1 if b < c)
    if len(t1) == 100:
        t0.extend(t1)
        t0.sort()
        t1 = []
print(result)
0