結果

問題 No.482 あなたの名は
ユーザー yun_app
提出日時 2017-03-14 17:20:26
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 74,060 KB
実行使用メモリ 55,328 KB
最終ジャッジ日時 2024-06-30 00:45:14
合計ジャッジ時間 8,426 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

/* 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)%2==0?"YES":"NO");
    }
}
0