結果

問題 No.1282 Display Elements
ユーザー c-yanc-yan
提出日時 2020-11-06 22:34:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 663 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 23,352 KB
最終ジャッジ日時 2023-09-29 19:14:20
合計ジャッジ時間 6,307 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,884 KB
testcase_01 AC 16 ms
7,940 KB
testcase_02 AC 16 ms
7,996 KB
testcase_03 AC 16 ms
7,972 KB
testcase_04 AC 16 ms
7,980 KB
testcase_05 AC 16 ms
7,956 KB
testcase_06 AC 16 ms
7,968 KB
testcase_07 AC 16 ms
7,972 KB
testcase_08 AC 16 ms
7,952 KB
testcase_09 AC 15 ms
7,888 KB
testcase_10 AC 21 ms
7,852 KB
testcase_11 AC 21 ms
7,920 KB
testcase_12 AC 16 ms
7,904 KB
testcase_13 AC 18 ms
8,000 KB
testcase_14 AC 20 ms
7,972 KB
testcase_15 AC 602 ms
21,984 KB
testcase_16 AC 232 ms
13,612 KB
testcase_17 AC 493 ms
19,392 KB
testcase_18 AC 299 ms
15,440 KB
testcase_19 AC 551 ms
23,200 KB
testcase_20 AC 547 ms
23,220 KB
testcase_21 AC 654 ms
23,352 KB
testcase_22 AC 634 ms
23,108 KB
testcase_23 AC 663 ms
23,056 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])
    t1.sort()
    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