結果

問題 No.694 square1001 and Permutation 3
ユーザー maspy
提出日時 2020-03-18 11:53:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 262,192 KB
最終ジャッジ日時 2024-12-14 01:38:51
合計ジャッジ時間 4,320 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 10 MLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import gc

def Inversion(seq):
    N = len(seq)
    bit = BinaryIndexedTree([0] * (N + 1))
    inv = N * (N - 1) // 2
    for x in seq:
        inv -= bit.get_sum(x)
        bit.add(x, 1)
    return inv


N, *A = map(int, read().split())
convert = {x: i for i, x in enumerate(sorted(set(A)), 1)}
A = tuple(convert[x] for x in A)
0