結果

問題 No.482 あなたの名は
ユーザー mastersatoshi
提出日時 2017-06-22 10:29:49
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 581 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 29,124 KB
最終ジャッジ日時 2024-10-02 10:10:54
合計ジャッジ時間 6,919 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 9 TLE * 1 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#import pdb; pdb.set_trace()
import sys
import math

def main():
    
    (n, k) = map(int, raw_input().split())
    d = map(int, raw_input().split())
    
    count = 0
    j = 0
    for i in range(n):
        tmpd = d[j]
        if tmpd - 1 != j:
            tmpe = d[tmpd - 1]
            d[tmpd - 1] = tmpd
            d[j] = tmpe
            
            count += 1
        else:
            j += 1
    
    while k > count:
        count += 2
        
    if k == count:
        print "YES"
    else:
        print "NO"
        
        
if __name__ == '__main__':
    main()
0