結果

問題 No.240 ナイト散歩
ユーザー CrossLunaCrossLuna
提出日時 2015-07-10 23:02:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,390 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 64,680 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-22 10:03:45
合計ジャッジ時間 1,658 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 WA -
testcase_31 AC 2 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0