結果

問題 No.482 あなたの名は
コンテスト
ユーザー flippergo
提出日時 2026-03-26 08:34:30
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 466 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 262 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 113,280 KB
最終ジャッジ日時 2026-03-26 08:34:36
合計ジャッジ時間 5,373 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,K = map(int,input().split())
D = list(map(int,input().split()))
m = 0
while 2**m<N:
    m += 1
M = 2**m
T = [0]*(M+1)
def plus(i,x):
    j = i
    while j<=M:
        T[j] += x
        j += j&(-j)
def cumsum(i):
    cnt = 0
    j = i
    while j>0:
        cnt += T[j]
        j -= j&(-j)
    return cnt
tot = 0
for i in range(N):
    k = D[i]
    tot += i-cumsum(k)
    plus(k,1)
if tot>K:
    print("No")
elif (K-tot)%2==0:
    print("Yes")
else:
    print("No")
0