結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2015-09-10 18:06:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 961 bytes |
コンパイル時間 | 1,490 ms |
コンパイル使用メモリ | 161,764 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 21:10:12 |
合計ジャッジ時間 | 2,622 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:36:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 36 | scanf("%d %d", &x, &y); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
// BCC /* #include <cstdio> #include <algorithm> #include <iostream> #include <utility> #include <vector> #include <queue> */ // GCC #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; i--) #define each(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define chmin(a, b) a = min(a, b) #define chmax(a, b) a = max(a, b) #define pb push_back #define mp make_pair typedef long long ll; const int INF = 1 << 28; const ll INFLL = 1ll << 56; int dx[] = {-2, -2, -1, -1, 1, 1, 2, 2}; int dy[] = {-1, 1, -2, 2, -2, 2, -1, 1}; typedef complex<int> P; int main() { int x, y; scanf("%d %d", &x, &y); vector<P> v(1, P(0, 0)); vector<P> d(8); rep(i, 8) d[i] = P(dx[i], dy[i]); rep(i, 1 + (1 << 3) + (1 << 6) + (1 << 9)){ if (v[i] == P(x, y)){ puts("YES"); return 0; } each(dir, d) v.pb(*dir + v[i]); } puts("NO"); }