結果

問題 No.1509 Swap!!
ユーザー manjuuu_onsenmanjuuu_onsen
提出日時 2021-05-14 23:42:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 1,734 ms
コンパイル使用メモリ 165,968 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 05:51:56
合計ジャッジ時間 9,405 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using pint = pair<int,int>;
void solve();

int main()
{
	int T;
	cin >> T;
	while(T--)solve();
}

bool f(ll x, ll y, ll N) {
	if(__gcd(x, y) != 1) return false;
	if(y * 2 <= N)return true;
	ll pos = N - y;
	// print(pos);
	
	if(pos + 1 >= x) {
		return true;
	}
	
	return false;
}






void solve()
{
	ll N; cin >> N;
	ll x, y; cin >> x >> y;
	if(x > y)swap(x, y);
	if(f(x, y, N)) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
}
0