結果
| 問題 | No.1115 二つの数列 / Two Sequences |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-12 15:00:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 405 bytes |
| 記録 | |
| コンパイル時間 | 298 ms |
| コンパイル使用メモリ | 82,384 KB |
| 実行使用メモリ | 211,316 KB |
| 最終ジャッジ日時 | 2024-09-19 21:56:36 |
| 合計ジャッジ時間 | 5,640 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 5 |
| other | AC * 3 TLE * 1 -- * 31 |
ソースコード
from bisect import bisect_left
def count_inversion(sequence):
return sum(sum(m<n for m in sequence[i+1:]) for i,n in enumerate(sequence))
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
b = []
for j in range(N):
b.append((B[j],j))
b.sort()
l = []
for i in range(N):
j = bisect_left(b,(A[i],0))
l.append(b[j][1])
ans = count_inversion(l)
print(ans)