結果

問題 No.240 ナイト散歩
ユーザー beet
提出日時 2018-08-03 15:34:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 1,353 ms
コンパイル使用メモリ 167,160 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 17:25:32
合計ジャッジ時間 2,292 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
Int dx[]={-2,-2,-1,-1,1,1,2,2};
Int dy[]={1,-1,2,-2,2,-2,1,-1};
void dfs(Int d,Int x,Int y){
  if(x==0&&y==0){
    cout<<"YES"<<endl;
    exit(0);
  }
  if(d==3) return;
  for(Int k=0;k<8;k++)
    dfs(d+1,x+dx[k],y+dy[k]);
}
signed main(){
  Int x,y;
  cin>>x>>y;
  dfs(0,x,y);
  cout<<"NO"<<endl;
  return 0;
}
0