結果

問題 No.208 王将
ユーザー h_nosonh_noson
提出日時 2016-02-16 23:55:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 60,180 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 06:04:44
合計ジャッジ時間 1,333 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (int i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (int i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)

int main() {
    int x1, y1, x2, y2, ans;
    cin >> x1 >> y1 >> x2 >> y2;
    ans = max(abs(x1),abs(y1));
    if (x1 == 0 && x2 == 0 && y1 < y2 || y1 == 0 && y2 == 0 && abs(x1) < abs(x2))
        ans++;
    else if (abs(x1) == abs(y1) && abs(x2) == abs(y2) && abs(x1) < abs(x2) && x1*x2 > 0 && y1*y2 > 0)
        ans++;
    cout << ans << endl;
    return 0;
}

0