結果

問題 No.482 あなたの名は
ユーザー mastersatoshimastersatoshi
提出日時 2017-06-22 10:29:49
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 581 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 27,684 KB
最終ジャッジ日時 2023-07-25 16:30:43
合計ジャッジ時間 7,423 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
10,496 KB
testcase_01 AC 12 ms
5,996 KB
testcase_02 AC 12 ms
5,916 KB
testcase_03 AC 12 ms
6,000 KB
testcase_04 AC 11 ms
5,996 KB
testcase_05 AC 12 ms
5,924 KB
testcase_06 AC 12 ms
5,924 KB
testcase_07 WA -
testcase_08 AC 12 ms
6,036 KB
testcase_09 AC 11 ms
5,924 KB
testcase_10 AC 12 ms
5,960 KB
testcase_11 AC 12 ms
6,108 KB
testcase_12 WA -
testcase_13 AC 12 ms
6,140 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 151 ms
23,324 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 152 ms
23,132 KB
testcase_20 AC 153 ms
23,292 KB
testcase_21 WA -
testcase_22 AC 151 ms
23,328 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

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