結果
問題 | No.482 あなたの名は |
ユーザー |
![]() |
提出日時 | 2017-02-10 22:41:12 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 1,299 ms |
コンパイル使用メモリ | 23,040 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 20:14:57 |
合計ジャッジ時間 | 2,920 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d %lld",&n,&k); | ^~~~~~~~~~~~~~~~~~~~~~ main.c:16:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d",d+i); | ^~~~~~~~~~~~~~~
ソースコード
#include <math.h>#include <stdio.h>#include <string.h>#include <stdlib.h>#include <assert.h>#include <limits.h>#include <stdbool.h>int main(){int n;long long int k;scanf("%d %lld",&n,&k);int d[n];int i,temp;for(i=0;i<n;i++){scanf("%d",d+i);d[i]--;}for(i=0;i<n;i++){while(i!=d[i]){temp=d[d[i]];d[d[i]]=d[i];d[i]=temp;k--;if(k<0){puts("NO");return 0;}}}if(k%2==0){puts("YES");}else{puts("NO");}return 0;}