結果
| 問題 | No.1509 Swap!! | 
| コンテスト | |
| ユーザー |  milanis48663220 | 
| 提出日時 | 2021-05-15 00:29:10 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,366 bytes | 
| コンパイル時間 | 999 ms | 
| コンパイル使用メモリ | 113,012 KB | 
| 最終ジャッジ日時 | 2025-01-21 12:49:55 | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 7 WA * 23 | 
ソースコード
#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-b >= a) return true;
    ll rl = n-b-1;
    ll lr = b%a, rr = (n-1)%a;
    // cout << rl << ' ' << lr << ' ' << rr << endl;
    if(lr <= rr){
        return (rl+1 >= lr) && (rr == a-1);
    }
    return rl+1 >= lr;
}
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;
    }
}
            
            
            
        