結果
問題 |
No.240 ナイト散歩
|
ユーザー |
|
提出日時 | 2015-07-10 23:02:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,390 bytes |
コンパイル時間 | 583 ms |
コンパイル使用メモリ | 65,524 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 02:04:19 |
合計ジャッジ時間 | 1,435 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 WA * 6 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <cstdio> #include <cstdlib> using namespace std; vector<int> mapx; vector<int> mapy; void update(vector<int>& mx, vector<int>& my, int x, int y, int layer){ if(layer <= 0) return; mx.push_back(x+2); my.push_back(y+1); update(mx, my, x+2, y+1, layer-1); mx.push_back(x+1); my.push_back(y+2); update(mx, my, x+1, y+2, layer-1); mx.push_back(x+2); my.push_back(y-1); update(mx, my, x+2, y-1, layer-1); mx.push_back(x+1); my.push_back(y-2); update(mx, my, x+1, y-2, layer-1); mx.push_back(x-2); my.push_back(y+1); update(mx, my, x-2, y+1, layer-1); mx.push_back(x-1); my.push_back(y+2); update(mx, my, x-1, y+2, layer-1); mx.push_back(x-2); my.push_back(y-1); update(mx, my, x-2, y-1, layer-1); mx.push_back(x-1); my.push_back(y-2); update(mx, my, x-1, y-2, layer-1); } int main(){ //int ax =0, ay=0; mapx.push_back(0); mapx.push_back(0); update(mapx, mapy, 0, 0, 3); int x, y; cin >> x >> y; bool ans = false; for (int i = 0; i < mapx.size(); i += 1) { if(x+mapx[i] == 0 and y+mapy[i]==0) ans = true; } if(ans){ cout << "YES" << endl; }else { cout << "NO" << endl; } return 0; }