結果
問題 | No.208 王将 |
ユーザー |
![]() |
提出日時 | 2016-03-27 21:14:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 832 bytes |
コンパイル時間 | 707 ms |
コンパイル使用メモリ | 73,472 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 16:30:12 |
合計ジャッジ時間 | 1,517 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include <algorithm>#include <cstdio>#include <iostream>#include <map>#include <math.h>#include <queue>#include <set>#include <sstream>#include <stack>#include <string>#include <vector>using namespace std;#define ll long long#define INF (1 << 30)#define INFLL (1LL << 60)int main() {int x1,x2,y1,y2;cin >> x1 >> y1;cin >> x2 >> y2;if(x2 < x1 && y2 < y1 && x1 > 0 && y1 > 0 && x1 == y1 && x2 == y2) cout << max(x1,y1) + 1 << endl;else if(x2 > x1 && y2 > y1 && x1 < 0 && y1 < 0 && x1 == y1 && x2 == y2) cout << max(-x1,-y1) + 1 << endl;else if(x2 < x1 && y2 > y1 && x1 > 0 && y1 < 0 && x1 == -y1 && x2 == -y2) cout << max(x1,y1) + 1 << endl;else if(x2 > x1 && y2 < y1 && x1 < 0 && y1 > 0 && -x1 == y1 && -x2 == y2) cout << max(x1,y1) + 1 << endl;else cout << max(abs(x1),abs(y1)) << endl;return 0;}