結果
| 問題 |
No.240 ナイト散歩
|
| コンテスト | |
| ユーザー |
tokizo
|
| 提出日時 | 2019-02-02 19:34:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 604 bytes |
| コンパイル時間 | 1,700 ms |
| コンパイル使用メモリ | 164,936 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 20:33:27 |
| 合計ジャッジ時間 | 6,589 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 3 |
| other | WA * 1 RE * 29 |
コンパイルメッセージ
main.cpp: In function 'bool dfs(int, int, int)':
main.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
18 | }
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
int x, y;
int dx[8] = {-2, -2, -1, -1, 1, 1, 2, 2};
int dy[8] = {-1, 1, -2, 2, -2, 2, -1, 1};
bool dfs(int a, int b, int cnt){
if(a == x and b == y) return true;
if(cnt == 3) return false;
for(int i = 0; i < 8; i++){
int nx, ny;
nx = dx[i] + a;
ny = dy[i] + b;
if(dfs(nx, ny, cnt + 1)) return true;
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> x >> y;
if(dfs(0, 0, 0)){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
}
tokizo