結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2018-05-15 20:56:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,576 bytes |
コンパイル時間 | 1,236 ms |
コンパイル使用メモリ | 163,976 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 12:10:59 |
合計ジャッジ時間 | 2,256 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | #define SCD2(m,n) scanf("%d%d",&m,&n) | ~~~~~^~~~~~~~~~~~~~ main.cpp:26:9: note: in expansion of macro ‘SCD2’ 26 | SCD2(X,Y); | ^~~~
ソースコード
#include <bits/stdc++.h>#define FOR(i,a,b) for(int i=(a);i<(b);++i)#define REP(i,n) for(int i=0;i<(n);++i)#define FORq(i, m, n) for(int i = (m);i <= (n);++i)#define SCD(n) scanf("%d",&n)#define SCD2(m,n) scanf("%d%d",&m,&n)#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)#define PB push_back#define MP make_pair#define ARSCD(A,N) REP(i,N){SCD(A[i]);}#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}#define PRINTD(n) printf("%d\n",n)#define PRINTLLD(n) printf("%lld\n",n)#define DEBUG printf("%s\n","debug")#define fst first#define snd second#define IN(x,S) (S.count(x) != 0)using namespace std;typedef pair<int,int> PII;typedef vector<int> VI;typedef long long ll;//////////////////////////////////////////////////////int main(){int X,Y;SCD2(X,Y);vector<PII>Q;Q.PB(MP(-2,-1));Q.PB(MP(-2,1));Q.PB(MP(-1,-2));Q.PB(MP(-1,2));Q.PB(MP(1,-2));Q.PB(MP(1,2));Q.PB(MP(2,-1));Q.PB(MP(2,1));REP(i,8){PII xy = Q[i];int x = xy.fst;int y = xy.snd;Q.PB(MP(x-2,y-1));Q.PB(MP(x-2,y+1));Q.PB(MP(x-1,y-2));Q.PB(MP(x-1,y+2));Q.PB(MP(x+1,y-2));Q.PB(MP(x+1,y+2));Q.PB(MP(x+2,y-1));Q.PB(MP(x+2,y+1));}REP(i,64){PII xy = Q[i+8];int x = xy.fst;int y = xy.snd;Q.PB(MP(x-2,y-1));Q.PB(MP(x-2,y+1));Q.PB(MP(x-1,y-2));Q.PB(MP(x-1,y+2));Q.PB(MP(x+1,y-2));Q.PB(MP(x+1,y+2));Q.PB(MP(x+2,y-1));Q.PB(MP(x+2,y+1));}REP(i,512){PII xy = Q[i];int x = xy.fst;int y = xy.snd;if ((x==X) and (y==Y)){printf("YES\n");return 0;}}printf("NO\n");return 0;}