結果

問題 No.482 あなたの名は
コンテスト
ユーザー Bantako
提出日時 2017-07-20 11:41:56
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 355 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 230 ms
コンパイル使用メモリ 38,784 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-25 01:20:23
合計ジャッジ時間 7,342 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 9 WA * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){
      | ^~~~

ソースコード

diff #
raw source code

#include<stdio.h>
main(){
    long long N,K;
    scanf("%lld%lld",&N,&K);
    int dif = 0;
    for(int i = 1;i <= N;i++){
        int d;
        scanf("%d",&d);
        dif += d!=i;
    }
    K -= (dif/2+dif%2);
    if(K < 0){
        printf("NO\n");
        return 0;
    }
    if(K%2){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
}
0