結果
問題 | No.696 square1001 and Permutation 5 |
ユーザー |
![]() |
提出日時 | 2018-06-08 23:25:13 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 653 ms |
コンパイル使用メモリ | 82,612 KB |
実行使用メモリ | 277,208 KB |
最終ジャッジ日時 | 2024-06-30 11:07:46 |
合計ジャッジ時間 | 37,426 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 RE * 7 |
ソースコード
n = int(input())p = list(map(int,input().split()))bit = [0 for i in range(n+1)]def sum(x):res = 0while x > 0:res = res + bit[x]x = x - (x&-x)return resdef add(x, y):if(x == 0):returnwhile x <= n:bit[x] = bit[x] + yx = x + (x&-x)ans = 1x = 1for i in range(1, n+1):ans = ans + sum(p[n-i]) * xadd(p[n-i], 1)x = x * iprint(ans)