結果
| 問題 | 
                            No.482 あなたの名は
                             | 
                    
| コンテスト | |
| ユーザー | 
                             yun_app
                         | 
                    
| 提出日時 | 2017-03-14 17:23:15 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 802 bytes | 
| コンパイル時間 | 1,979 ms | 
| コンパイル使用メモリ | 74,400 KB | 
| 実行使用メモリ | 64,208 KB | 
| 最終ジャッジ日時 | 2024-06-30 00:45:39 | 
| 合計ジャッジ時間 | 8,371 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 WA * 11 | 
ソースコード
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        long K = Long.parseLong(lines[1]);
        
        long cnt = 0;
        lines = br.readLine().split(" ");
        for(int i=1;i<=N;i++){
            if(i > Integer.parseInt(lines[i-1])){
                cnt++;
            }
        }
        
        System.out.println(K>=cnt&&(K-cnt)%2==0?"YES":"NO");
    }
}
            
            
            
        
            
yun_app