結果
問題 |
No.1714 Tag on Grid
|
ユーザー |
|
提出日時 | 2021-10-22 21:31:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 872 bytes |
コンパイル時間 | 2,249 ms |
コンパイル使用メモリ | 192,460 KB |
最終ジャッジ日時 | 2025-01-25 03:18:39 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int H, W; cin >> H >> W; int ni, nj; cin >> ni >> nj; int zi, zj; cin >> zi >> zj; int dx[4] = {0, -1, 0, 1}, dy[4] = {1, 0, -1, 0}; for(int i = 0; i < 4; i++){ int nx = ni + dx[i], ny = nj + dy[i]; if(nx == zi && ny == zj){ cout << "Yes" << endl; return 0; } else if(abs(nx - zi) == 1 && abs(ny - zj) == 1){ cout << "Yes" << endl; return 0; } } if(H == 2){ if(zi != ni && zj % 2 == nj % 2) cout << "Yes" << endl; else if(zi == ni && zj % 2 != nj % 2) cout << "Yes" << endl; } else if(W == 2){ if(zj != nj && zi % 2 == ni % 2) cout << "Yes" << endl; else if(zj == nj && zi % 2 != nj % 2) cout << "Yes" << endl; } cout << "No" << endl; }