結果

問題 No.482 あなたの名は
ユーザー YamyukiYamyuki
提出日時 2017-02-11 01:07:19
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 24,128 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-28 12:38:55
合計ジャッジ時間 1,951 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>

long b[200000];

int main(int argc, char const *argv[]) {
	long n,k,i,w=0,p=0,min;
	scanf("%ld %ld",&n,&k);
	for(i=0;i<n;i++){
		scanf("%ld",&b[i]);
	}
	for(i=0;i<n;i++){
		if(i+1!=b[i]){
			w++;
			if(i+1==b[b[i]-1]){
				p++;
			}
		}
	}
	min=(w-p-1)+p/2;
	if(min<=k && min%2==k%2) printf("YES\n");
	else printf("NO\n");
	return 0;
}
0