結果

問題 No.1509 Swap!!
ユーザー milanis48663220milanis48663220
提出日時 2021-05-14 23:24:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,266 bytes
コンパイル時間 1,076 ms
コンパイル使用メモリ 113,720 KB
最終ジャッジ日時 2025-01-21 12:18:59
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 26 WA * 3 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

bool solve(ll n, ll a, ll b){
    if(a == 1) return true;
    if(gcd(a, b) != 1) return false;
    // if((n)/2 < b) return false;
    if((n+1)/2 >= b) return true;
    if((n)/2 < a) return false;
    if(n%2 == 0 && n == a*2) {
        throw "";
        return false;
    }
    if(n-a < b) return false;
    return true;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int t; cin >> t;
    while(t--) {
        ll n, a, b; cin >> n >> a >> b;
        if(a > b) swap(a, b);
        if(solve(n, a, b)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}
0