結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-26 08:35:30 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 466 bytes |
| 記録 | |
| コンパイル時間 | 269 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 113,408 KB |
| 最終ジャッジ日時 | 2026-03-26 08:35:40 |
| 合計ジャッジ時間 | 4,027 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 7 |
ソースコード
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")