結果

問題 No.1282 Display Elements
ユーザー realDivineJKrealDivineJK
提出日時 2020-11-06 22:17:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 96,848 KB
最終ジャッジ日時 2023-09-29 18:58:45
合計ジャッジ時間 4,121 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,236 KB
testcase_01 AC 70 ms
71,248 KB
testcase_02 AC 70 ms
71,252 KB
testcase_03 AC 71 ms
71,184 KB
testcase_04 AC 70 ms
71,256 KB
testcase_05 AC 71 ms
71,252 KB
testcase_06 AC 71 ms
71,372 KB
testcase_07 AC 71 ms
71,420 KB
testcase_08 AC 71 ms
71,476 KB
testcase_09 AC 70 ms
71,372 KB
testcase_10 AC 74 ms
75,692 KB
testcase_11 AC 73 ms
75,480 KB
testcase_12 AC 71 ms
71,352 KB
testcase_13 AC 78 ms
75,784 KB
testcase_14 AC 80 ms
76,156 KB
testcase_15 AC 187 ms
95,948 KB
testcase_16 AC 130 ms
85,984 KB
testcase_17 AC 158 ms
96,848 KB
testcase_18 AC 135 ms
89,204 KB
testcase_19 AC 112 ms
94,460 KB
testcase_20 AC 111 ms
94,288 KB
testcase_21 AC 184 ms
96,232 KB
testcase_22 AC 176 ms
95,924 KB
testcase_23 AC 185 ms
96,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
cnt = 0
for i in range(N):
    if B[i] < A[i]:
        cnt += N - i
    elif B[i] >= A[-1]:
        cnt += 0
    else:
        l, r = i, N
        d = (l + r) // 2
        for j in range(len(bin(N))):
            if A[d] <= B[i]:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        cnt += N - d - 1
print(cnt)
0