結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-04-20 07:22:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 570 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 23,296 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:07:43 |
合計ジャッジ時間 | 2,320 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | scanf("%lld",&N); | ~~~~~^~~~~~~~~~~ main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%lld",&K); | ~~~~~^~~~~~~~~~~ main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%lld",&hairetu[i]); | ~~~~~^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void){ long long int N,K,i,count,tmp; 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++) { while(i!=hairetu[i]) { tmp=hairetu[i]; hairetu[i]=hairetu[tmp]; hairetu[tmp]=tmp; count++; } } printf("%lld\n",count); if((K-count)%2==0 && K-count>=0) { printf("YES"); } else { printf("NO"); } }