結果
問題 | No.240 ナイト散歩 |
ユーザー |
|
提出日時 | 2020-04-26 02:47:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 6,576 ms |
コンパイル使用メモリ | 190,772 KB |
最終ジャッジ日時 | 2025-01-10 01:47:18 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);i++)using namespace std;bool dfs(int x,int y,int i){if(x==0 && y==0) return true;if(i==3) return false;for(int dx=-2;dx<=2;dx++) for(int dy=-2;dy<=2;dy++) if(abs(dx)+abs(dy)==3) {if(dfs(x+dx,y+dy,i+1)) return true;}return false;}int main(){int x,y; cin>>x>>y;cout<<(dfs(x,y,0)?"YES":"NO")<<'\n';return 0;}