結果
| 問題 | 
                            No.240 ナイト散歩
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kuro
                         | 
                    
| 提出日時 | 2021-04-30 14:49:22 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,198 bytes | 
| コンパイル時間 | 1,843 ms | 
| コンパイル使用メモリ | 168,280 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-18 12:03:48 | 
| 合計ジャッジ時間 | 2,255 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 4 | 
| other | WA * 30 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
struct Vec2D {
  Vec2D(uint64_t _x, uint64_t _y) : x(_x), y(_y) {}
  uint64_t x;
  uint64_t y;
};
bool check(const Vec2D pos, const Vec2D targ) {
  if (pos.x == targ.x && pos.y == targ.y) {
    return true;
  } else {
    return false;
  }
}
int main() {
  uint64_t X, Y;
  cin >> X >> Y;
  Vec2D moveList[8] = {Vec2D(-2, -1), Vec2D(-2, 1), Vec2D(-1, -2), Vec2D(-1, 2),
                       Vec2D(1, -2),  Vec2D(1, 2),  Vec2D(2, -1),  Vec2D(2, 1)};
  if (X == 0 && Y == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  const Vec2D targ(X, Y);
  for (int i = 0; i < 8; ++i) {
    Vec2D p0 = moveList[i];
    if (check(p0, targ)) {
      cout << "Yes" << endl;
      return 0;
    }
    for (int j = 0; j < 8; ++j) {
      Vec2D p1 = p0;
      p1.x += moveList[j].x;
      p1.y += moveList[j].y;
      if (check(p1, targ)) {
        cout << "Yes" << endl;
        return 0;
      }
      for (int k = 0; k < 8; ++k) {
        Vec2D p2 = p1;
        p2.x += moveList[k].x;
        p2.y += moveList[k].y;
        if (check(p2, targ)) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
}
            
            
            
        
            
kuro