結果

問題 No.240 ナイト散歩
ユーザー CrossLunaCrossLuna
提出日時 2015-07-10 23:11:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,596 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 66,260 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 10:09:05
合計ジャッジ時間 1,931 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 WA -
testcase_31 WA -
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<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, long long 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;
    for (long long int i = 0; i < mapx.size(); i += 1)
    {
        if(x+mapx[i] == 0 and y+mapy[i]==0)
            ans = true;
        //cout << mapx[i] << " , " << mapy[i] << endl;
    }
    if(ans){
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }
 
    return 0;
}
0