結果

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

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstdlib>

using namespace std;

vector<long long int> mapx;
vector<long long int> mapy;

void update(vector<long long int>& mx, vector<long long int>& my, long long int x, long long int y, int layer){
    if(layer <= 0){
        return;
    }

    mx.push_back(x);
    my.push_back(y);

    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(){
    //long long int ax =0, ay=0;
    mapx.push_back(0);
    mapx.push_back(0);
    update(mapx, mapy, 0, 0, 3);
    long long int x, y;
    cin >> x >> y;
    bool ans = false;
    if(-7<x and x<7 and -7<y and y<7){
    for (int i = 0; i < mapx.size(); i += 1)
    {
        if(x == mapx[i] and y == mapy[i])
            ans = true;
        //cout << mapx[i] << " , " << mapy[i] << endl;
    }
    }
    if(ans){
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }
 
    return 0;
}
0