結果
| 問題 | No.240 ナイト散歩 |
| コンテスト | |
| ユーザー |
mencotton
|
| 提出日時 | 2020-02-14 18:24:49 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 413µs | |
| コード長 | 610 bytes |
| 記録 | |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 72,704 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-09-11 01:24:34 |
| 合計ジャッジ時間 | 2,279 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <iostream>
using namespace std;
int gx, gy;
bool dfs(int x, int y, int depth) {
if (depth > 3)return false;
if (x == gx && y == gy) return true;
return dfs(x - 2, y - 1, depth + 1) ||
dfs(x - 2, y + 1, depth + 1) ||
dfs(x - 1, y - 2, depth + 1) ||
dfs(x - 1, y + 2, depth + 1) ||
dfs(x + 1, y - 2, depth + 1) ||
dfs(x + 1, y + 2, depth + 1) ||
dfs(x + 2, y - 1, depth + 1) ||
dfs(x + 2, y + 1, depth + 1);
}
int main() {
cin >> gx >> gy;
cout << (dfs(0, 0, 0) ? "YES" : "NO") << endl;
return 0;
}
mencotton