結果

問題 No.482 あなたの名は
ユーザー onoyik0515onoyik0515
提出日時 2017-04-20 01:47:45
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 28,672 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-26 15:27:02
合計ジャッジ時間 2,123 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,384 KB
testcase_06 WA -
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 23 ms
4,380 KB
testcase_17 AC 23 ms
4,380 KB
testcase_18 AC 22 ms
4,388 KB
testcase_19 WA -
testcase_20 AC 23 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 23 ms
4,376 KB
testcase_27 AC 23 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 23 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void){
    long long int N,K,i,count,k,p;
    scanf("%lld",&N);
    scanf("%lld",&K);
    long long int hairetu[N];
    for(i=1;i<=N;i++)
    {
        scanf("%lld",&hairetu[i]);
    }
    count=0;
    for(i=1;i<=N;i++)
    {   
     if(i  ==! hairetu[i])
{
    p=hairetu[i];
        while(i == !hairetu[p])
        {
           k=hairetu[p];
            hairetu[p]=p;
   if(p  ==! i)
           {p=k;}
else {p=1;}
            count++;
        }
    }
}
    if((K-count)%2==0 && K-count>=0)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }
}
0