結果
| 問題 |
No.240 ナイト散歩
|
| ユーザー |
ramia777
|
| 提出日時 | 2022-05-31 02:26:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,009 bytes |
| コンパイル時間 | 1,073 ms |
| コンパイル使用メモリ | 99,508 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-21 01:00:31 |
| 合計ジャッジ時間 | 2,357 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 RE * 2 |
ソースコード
// yukicodr
//No.240
//二次元可変配列
//vector <vector <int>> mass;
//vector <vector <int>> memo;
//vector <int> memo;
//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>//list
#include <queue> //queue
#include <set> //tree
#include <map> //連想配列
#include <unordered_set> //hash
#include <unordered_map> //hash
#include <algorithm>
#include <iomanip>
#include <cstring>
//#include <bits/stdc++.h>
using namespace std;
#define FOR(x,to) for(x=0;x<to;x++)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define FMAX(a,b) ((a)>(b)?(a):(b))
#define FMIN(a,b) ((a)<(b)?(a):(b))
#define FCEIL(a,b) ((a)+(b)-1)/(b)
typedef unsigned long long ULL;
typedef signed long long SLL;
//昇順
int compare_up(const int * a, const int *b)
{
if (*a > *b)
return (1);
else if (*a < *b)
return (-1);
return (0);
}
//降順
int compare_down(const int * a, const int *b)
{
if (*a > *b)
return (-1);
else if (*a < *b)
return (1);
return (0);
}
int solve(int i, ULL index_flag)
{
return 0;
}
SLL dx[8] = { -2,-2,-1,-1, 1, 1, 2, 2 };
SLL dy[8] = { -1, 1,-2, 2,-2, 2,-1, 1 };
SLL X, Y;
typedef struct COORD {
SLL x;
SLL y;
}COORD;
queue<COORD> _queue;
COORD a;
SLL ban[25][25];
int main()
{
SLL k = 0;
cin >> X;
cin >> Y;
if (X >= 10 || Y >= 10)
{
cout << "NO" << endl;
return 0;
}
a.x = 0;
a.y = 0;
ban[a.y + 10][a.x + 10] = 8;
for (int j = 0; j <65; j++)
{
for (int i = 0; i < 8; i++)
{
COORD c;
c.x =a.x+ dx[i];
c.y =a.y+ dy[i];
if(c.y ==0 && c.x == 0)
ban[c.y + 10][c.x + 10] = 8;
else
ban[c.y + 10][c.x + 10] = 1;
_queue.push(c); //キューに入れる
}
//先頭を見る
a = _queue.front();
//先頭を取り除く
_queue.pop();
}
/*
for (int y = 0;y<20;y++)
{
for (int x = 0; x < 20;x++)
cout << ban[y][x];
cout << endl;
}
*/
if (ban[Y+10][X+10])
cout << "YES" << endl;
else
cout << "NO" << endl;
//getchar();
return 0;
}
ramia777