結果

問題 No.208 王将
コンテスト
ユーザー machy
提出日時 2015-06-13 11:41:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 727 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 66,604 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 16:03:17
合計ジャッジ時間 1,257 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 * 100 << endl;
    return 0;
}
0