結果
| 問題 | No.240 ナイト散歩 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-21 23:46:26 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 760µs | |
| コード長 | 609 bytes |
| 記録 | |
| コンパイル時間 | 3,210 ms |
| コンパイル使用メモリ | 202,196 KB |
| 実行使用メモリ | 9,924 KB |
| 最終ジャッジ日時 | 2026-10-28 17:35:57 |
| 合計ジャッジ時間 | 4,434 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
using namespace std;
using P = pair<int, int>;
using tu = tuple<int, int, int>;
int main(void){
int x, y; cin >> x >> y;
int di[9]={-2, -2, -1, -1, 1, 1, 2, 2, 0};
int dj[9]={-1, 1, -2, 2, -2, 2, -1, 1, 0};
set<P> co;
auto dfs=[&](auto dfs, int step, int ni, int nj)->void {
if(step==3){
co.emplace(ni, nj); return;
}
for(int k=0; k<9; k++){
dfs(dfs, step+1, ni+di[k], nj+dj[k]);
}
return;
};
dfs(dfs, 0, 0, 0);
cout << (co.count(P(x, y))?"YES":"NO") << endl;
return 0;
}