結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,976 KB
testcase_01 AC 16 ms
7,876 KB
testcase_02 AC 17 ms
7,896 KB
testcase_03 AC 16 ms
7,856 KB
testcase_04 AC 16 ms
7,952 KB
testcase_05 AC 16 ms
7,920 KB
testcase_06 AC 16 ms
7,904 KB
testcase_07 AC 16 ms
7,848 KB
testcase_08 AC 16 ms
8,024 KB
testcase_09 AC 15 ms
7,976 KB
testcase_10 AC 20 ms
8,360 KB
testcase_11 AC 19 ms
7,844 KB
testcase_12 AC 16 ms
7,876 KB
testcase_13 AC 18 ms
7,972 KB
testcase_14 AC 20 ms
7,928 KB
testcase_15 AC 907 ms
22,044 KB
testcase_16 AC 243 ms
13,912 KB
testcase_17 AC 669 ms
19,672 KB
testcase_18 AC 341 ms
15,544 KB
testcase_19 AC 668 ms
24,568 KB
testcase_20 AC 823 ms
23,144 KB
testcase_21 AC 1,011 ms
23,136 KB
testcase_22 AC 980 ms
23,228 KB
testcase_23 AC 1,018 ms
23,236 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):
    t1.append(b[i])
    result += bisect_left(t0, a[i])
    result += sum(1 for b in t1 if b < a[i])
    if len(t1) == 100:
        t0.extend(t1)
        t0.sort()
        t1 = []
print(result)
0