結果

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

ソースコード

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&&(K-cnt)%2==0?"YES":"NO");
    }
}
0