結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-07-20 11:41:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 355 bytes |
コンパイル時間 | 377 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-08 17:36:27 |
合計ジャッジ時間 | 2,903 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 9 WA * 19 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 2 | main(){ | ^~~~ 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%lld",&N,&K); | ~~~~~^~~~~~~~~~~~~~~~~~ main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&d); | ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h> main(){ long long N,K; scanf("%lld%lld",&N,&K); int dif = 0; for(int i = 1;i <= N;i++){ int d; scanf("%d",&d); dif += d!=i; } K -= (dif/2+dif%2); if(K < 0){ printf("NO\n"); return 0; } if(K%2){ printf("YES\n"); }else{ printf("NO\n"); } }