結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2025-03-27 00:35:28 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 731 bytes |
コンパイル時間 | 3,629 ms |
コンパイル使用メモリ | 280,756 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-27 00:35:33 |
合計ジャッジ時間 | 5,112 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); constexpr array<int, 8> dx = { -2, -2, -1, -1, 1, 1, 2, 2 }; constexpr array<int, 8> dy = { -1, 1, -2, 2, -2, 2, -1, 1 }; set<pair<int, int>> cand = { { 0, 0 } }; rep(_, 3) { set<pair<int, int>> nxt; for (const auto& [x, y] : cand) { rep(i, 8) nxt.insert({ x + dx[i], y + dy[i] }); } cand.merge(nxt); } int x, y; cin >> x >> y; cout << (cand.contains({ x, y }) ? "YES" : "NO") << '\n'; return 0; }