結果

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

ソースコード

diff #
raw source code

// Online compiler C++
#include<bits/stdc++.h>
using namespace std ;
#define nl "\n"
#define int long long
using vi = vector<int> ;

void solve() {
    int x , y ;
    cin >> x >> y ;
    
    if( !x && !y ) cout << 0 << nl ;
    else if( abs(x) == abs(y) || !x || !y ) cout << 1 << nl ; // All 4 dir-bishops
    else cout << 2 << nl ; // dia + rook.
    
}
signed main() {
    int t = 1 ;
    // cin >> t ;
    while( t-- ) {
        solve() ;
    }
    return 0 ;
} 
0