結果
問題 |
No.228 ゆきこちゃんの 15 パズル
|
ユーザー |
|
提出日時 | 2015-06-20 01:58:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 316 bytes |
コンパイル時間 | 136 ms |
コンパイル使用メモリ | 24,448 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 04:35:05 |
合計ジャッジ時間 | 734 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 9 WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d",&k); | ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> int A[15]; int main(){ int y=0,x=0,k,p=0; for(;x<16;x++){ scanf("%d",&k); if(k){ A[y++]=k--; int d=abs(x/4-k/4)+abs(x%4-k%4); if(d>1){puts("No");return 0;} }else{ p=abs(x-3)%2; } } for(x=0;x<15;x++)for(y=x+1;y<15;y++)p^=A[x]>A[y]; puts(p?"No":"Yes"); }