結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-04-20 01:20:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 562 bytes |
コンパイル時間 | 126 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-07-19 09:32:53 |
合計ジャッジ時間 | 3,785 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 1 WA * 1 TLE * 1 -- * 25 |
コンパイルメッセージ
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,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; p=k; count++; } } } if((K-count)%2==0 && K-count>=0) { printf("YES"); } else { printf("NO"); } }