結果

問題 No.3108 Luke or Bishop
ユーザー jiyujin816
提出日時 2025-04-20 10:16:53
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,319 bytes
コンパイル時間 3,335 ms
コンパイル使用メモリ 280,816 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-20 10:16:58
合計ジャッジ時間 4,578 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/dsu>
#include <atcoder/segtree>
#include <atcoder/lazysegtree>
#include <atcoder/fenwicktree>
#include <atcoder/modint>
//以下cout時の色設定
#define COUTRESET "\033[0m" // 色をリセット
#define COUTRED "\033[31m" // 赤色
#define COUTGREEN "\033[32m" // 緑色
#define COUTYELLOW "\033[33m" // 黄色
#define COUTBLUE "\033[34m" // 青色
using namespace std;
using namespace atcoder;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using mint=modint998244353;
using mint2=modint1000000007;
//任意modint
using mint3=static_modint<1000000000>;
//using P=pair<ll,ll>;
const ll INF=1e17; 
const vector<ll> dx={0,0,1,-1,1,1,-1,-1};
const vector<ll> dy={1,-1,0,0,1,-1,-1,1};
#define rep(i,N) for(int i=0;i<N;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
template <typename T1,typename T2>
ostream& operator<<(ostream &os,pair<T1,T2> &pai){
    return os<<"("<<pai.first<<","<<pai.second<<") ";
}
template<typename T>
ostream& operator<<(ostream &os,vector<T> vec){
    for(auto val:vec){
        os<<val<<" ";
    }
    return os<<"\n";
}
template<typename T>
istream& operator>>(istream &is,vector<T> &vec){
    for(int i=0;i<(int)vec.size();i++){
        is>>vec[i];
    }
    return is;
}
template<typename T,typename T2>
istream& operator>>(istream &is,pair<T,T2> &pai){
    is>>pai.first>>pai.second;
    return is;
}
template <typename T> void print(const T &vec){
    int i=0;
    for(auto val:vec){
        cout<<i<<":"<<val<<",";
        i++;
    }
    cout<<'\n';
}
template<typename T> void print2(const vector<vector<T>> &vec){
    int i=0;
    for(auto v:vec){
        cout<<i<<": ";
        for(auto a:v){
            cout<<a<<" ";
        }
        i++;
        cout<<'\n';
    }
}
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
    return;
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
    return;
}

int main(){
    cin.tie(0)->sync_with_stdio(0);    
    ll Gx,Gy;
    cin>>Gx>>Gy;
    if(Gx==0 && Gy==0){
        cout<<0;
        return 0;
    }else if(Gx==0 || Gy==0){
        cout<<1;
        return 0;
    }
    if(Gx==Gy){
        cout<<1;
        return 0;
    }
    if(-1*Gx==Gy){
        cout<<1;
        return 0;
    }
    cout<<2;
}
0