結果

問題 No.3108 Luke or Bishop
コンテスト
ユーザー vjudge1
提出日時 2026-02-10 02:28:13
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 2,324 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,671 ms
コンパイル使用メモリ 333,124 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2026-02-10 02:28:19
合計ジャッジ時間 4,556 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

#define LL long long

#define VI vector<int>

#define VL vector<long long>

#define VVL vector<vector<long long>>

#define VVI vector<vector<int>>

#define VS vector<string>

#define ITR(var, start, end) for(int var = start; var < end; var++)

#define PUB push_back

#define POB pop_back

//macro for printing values of a one dimensional array (line by line)
#define OUT1(arr) ITR(i, 0, arr.size()) cout << arr[i] << endl;

//macro for printing values of a one dimensional array (space by space)
#define OUT2(arr) do {\
    ITR(i, 0, arr.size()){\
        i == arr.size() - 1 ? cout << arr[i] : cout << arr[i] << " ";\
    }\
    cout << "\n";\
} while(0)

//macro for printing values of a one dimensional array (line by line and with CASE)
#define OUT3(arr) do{\
    ITR(i, 0, arr.size()){\
        cout << "Case " << i + 1 << ": " << arr[i] << "\n";\
    }\
} while(0)

//macro for printing the values of a two dimensional array (space by space)
#define OUT4(arr) do{\
    ITR(i, 0, arr.size()){\
        ITR(j, 0, arr[i].size()){\
            j == arr[i].size() - 1 ? cout << arr[i][j] : cout << arr[i][j] << " ";\
        }\
        cout << "\n";\
    }\
} while(0)

//macro for printing the values of a two dimensional array (space by space and with CASE)
#define OUT5(arr) do{\
    ITR(i, 0, arr.size()){\
        cout << "Case " << i + 1 << ":" << "\n";\
        ITR(j, 0, arr[i].size()){\
            j == arr[i].size() - 1 ? cout << arr[i][j] : cout << arr[i][j] << " ";\
        }\
        cout << "\n";\
    }\
} while(0)

int main(void){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //IF THE GOAL IS ON THE ORIGIN THEN NO MOVE (thora brain issue hai)
    //if the goal is on the first row or first column then rook takes in one move
    //if the goal is lying on the diagonal where row and col abs diff is the same
    //then the bishop will always be able to reach it in one step
    //otherwise, if the bishop cannot directly in one step reach the goal
    //then whichever cell it may be, the rook will always reach it in 2 steps
    LL a, b;
    cin >> a >> b;
    a = abs(a); b = abs(b);
    if(a == 0 && b == 0) cout << 0 << endl;
    if(a == 0 || b == 0) cout << 1 << endl;
    else{ a == b ? cout << 1 << endl : cout << 2 << endl; }
}






0