結果
問題 |
No.228 ゆきこちゃんの 15 パズル
|
ユーザー |
![]() |
提出日時 | 2015-06-19 22:34:13 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 715 bytes |
コンパイル時間 | 465 ms |
コンパイル使用メモリ | 80,192 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 04:06:25 |
合計ジャッジ時間 | 1,040 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:28:19: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 28 | char *ans="Yes"; | ^~~~~ main.cpp:37:29: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 37 | ans="No"; | ^~~~
ソースコード
#include<sstream> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<string> #include<vector> #include<set> #include<map> #include<queue> #include<numeric> #include<functional> #include<algorithm> using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) #define indexOf(v,x) (find(all(v),x)-v.begin()) int main(){ int a[4][4]; rep(y,4)rep(x,4)cin>>a[y][x]; char *ans="Yes"; rep(y,4)rep(x,4){ int d=a[y][x]; if(d==0)continue; d--; int dy,dx; dy=d/4; dx=d%4; if(abs(dy-y)+abs(dx-x)>1){ ans="No"; } } cout<<ans<<endl; return 0; }