結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2020-04-19 01:05:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 472 bytes |
コンパイル時間 | 1,809 ms |
コンパイル使用メモリ | 170,324 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 00:37:13 |
合計ジャッジ時間 | 2,487 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;int x[8]={1,1,2,2,-1,-1,-2,-2},y[8]={2,-2,1,-1,2,-2,1,-1};typedef pair<int,int> P;template<typename T>void fin(T a){cout<<a<<endl;exit(0);}signed main(){int xx,yy;cin>>xx>>yy;vector<P> v;v.push_back(P(0,0));for(int _=0;_<3;_++){int a=v.size();for(int i=0;i<a;i++)for(int j=0;j<8;j++)v.push_back(P(v[i].first+x[j],v[i].second+y[j]));}for(P p:v)if(p==P(xx,yy))fin("YES");fin("NO");}