結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-11 01:07:19 |
| 言語 | C90 (gcc 15.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 354 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 36,480 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-24 21:06:42 |
| 合計ジャッジ時間 | 2,126 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 17 WA * 11 |
ソースコード
#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;
}