結果
| 問題 |
No.696 square1001 and Permutation 5
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2018-06-08 23:13:33 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 444 bytes |
| コンパイル時間 | 124 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 49,484 KB |
| 最終ジャッジ日時 | 2024-06-30 11:02:16 |
| 合計ジャッジ時間 | 41,920 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 3 RE * 7 |
ソースコード
import numpy as np
n = int(input())
p = list(map(int,input().split()))
bit = np.zeros(n+1, dtype = int)
def sum(x):
res = 0
while x > 0:
res = res + bit[x]
x = x - (x&-x)
return res
def add(x, y):
if(x == 0):
return
while x <= n:
bit[x] = bit[x] + y
x = x + (x&-x)
ans = 1
x = 1
for i in range(1, n+1):
ans = ans + sum(p[n-i]) * x
add(p[n-i], 1)
x = x * i
print(ans)
beet