結果
| 問題 |
No.228 ゆきこちゃんの 15 パズル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-13 01:30:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,041 bytes |
| コンパイル時間 | 1,347 ms |
| コンパイル使用メモリ | 167,464 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-27 07:00:52 |
| 合計ジャッジ時間 | 2,072 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 7 |
ソースコード
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
#define MOD LL(1e9 + 7)
#define INF 1000000
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;
int a[4][4];
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
bool bo[4][4];
int main() {
int z = 1;
REP(j, 4) {
REP(i, 4) {
cin >> a[j][i];
if (a[j][i] == z)
bo[j][i] = true;
z++;
}
}
if (a[3][3] == 0)
bo[3][3] = true;
bool ans = true;
z = 1;
REP(j, 4) {
REP(i, 4) {
if (!bo[j][i]) {
bool t = false;
REP(k, 4) {
int ny = i + dy[k];
int nx = j + dx[k];
if (ny < 0 || nx < 0 || ny > 3 || nx > 3)
continue;
if (a[ny][nx] == z) {
t = true;
break;
}
}
ans = t;
}
z++;
if (z == 16)
z = 0;
}
}
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}