結果
| 問題 |
No.208 王将
|
| コンテスト | |
| ユーザー |
machy
|
| 提出日時 | 2015-06-13 11:27:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 720 bytes |
| コンパイル時間 | 575 ms |
| コンパイル使用メモリ | 66,732 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 16:02:53 |
| 合計ジャッジ時間 | 1,435 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 WA * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long LL;
LL iabs(LL n){
if(n < 0) return -n;
return n;
}
int main(){
int x, y, x2, y2;
cin >> x >> y >> x2 >> y2;
LL ans = 0;
if(y >= 0){
ans += max(iabs(x), iabs(y));
if(iabs(x) == iabs(y) && iabs(x2) == iabs(y2) && iabs(x) > iabs(x2) && x/y == x2/y2){
ans += 1;
}
if(y == 0 && ((x < 0 && x < x2 && x2 < 0) || (x > 0 && x2 < x && x2 > 0))){
ans += 1;
}
}else{
ans += iabs(x) + iabs(y);
if(x == 0 && y < y2 && y2 < 0){
ans += 2;
}
}
cout << ans << endl;
return 0;
}
machy