結果
問題 | No.240 ナイト散歩 |
ユーザー |
|
提出日時 | 2022-09-27 21:28:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 2,147 ms |
コンパイル使用メモリ | 201,236 KB |
最終ジャッジ日時 | 2025-02-07 17:30:56 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int dx[] = {-2, -2, -1, -1, +1, +1, +2, +2}; int dy[] = {-1, +1, -2, +2, -2, +2, -1, +1}; set<pair<int,int>> S = {{0, 0}}; rep(_,3) { set<pair<int,int>> T; for(auto [x, y] : S) rep(d,8) T.insert({x + dx[d], y + dy[d]}); for(auto [x, y] : T) S.insert({x, y}); } int X,Y; cin >> X >> Y; cout << (S.count({X, Y}) ? "YES" : "NO") << endl; }