結果

問題 No.1509 Swap!!
ユーザー marroncastlemarroncastle
提出日時 2021-05-14 23:34:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 78,068 KB
最終ジャッジ日時 2024-04-10 04:09:36
合計ジャッジ時間 5,041 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,224 KB
testcase_01 AC 36 ms
52,608 KB
testcase_02 AC 114 ms
78,052 KB
testcase_03 AC 113 ms
77,840 KB
testcase_04 AC 114 ms
77,564 KB
testcase_05 AC 119 ms
77,956 KB
testcase_06 AC 114 ms
77,952 KB
testcase_07 AC 114 ms
77,568 KB
testcase_08 AC 116 ms
77,568 KB
testcase_09 AC 113 ms
77,952 KB
testcase_10 AC 112 ms
77,696 KB
testcase_11 AC 87 ms
77,980 KB
testcase_12 AC 85 ms
77,696 KB
testcase_13 AC 86 ms
77,332 KB
testcase_14 AC 86 ms
77,796 KB
testcase_15 AC 88 ms
77,632 KB
testcase_16 AC 81 ms
77,440 KB
testcase_17 AC 80 ms
77,696 KB
testcase_18 AC 79 ms
77,652 KB
testcase_19 AC 80 ms
77,824 KB
testcase_20 AC 82 ms
77,568 KB
testcase_21 AC 110 ms
77,776 KB
testcase_22 AC 110 ms
78,068 KB
testcase_23 AC 110 ms
77,672 KB
testcase_24 AC 111 ms
77,440 KB
testcase_25 AC 109 ms
77,568 KB
testcase_26 AC 112 ms
77,760 KB
testcase_27 AC 79 ms
77,312 KB
testcase_28 AC 77 ms
77,596 KB
testcase_29 AC 77 ms
77,708 KB
testcase_30 AC 95 ms
77,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,os,io
input = sys.stdin.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
T = int(input())
ans = ['NO']*T
def extgcd(a, b): # ax + by = d
  if b==0:
    return a, 1, 0 # a・1 + b・0 = a (b = 0のとき)
  d, y, x = extgcd(b, a%b)
  y -= (a//b)*x
  return d, x, y
from math import gcd
for t in range(T):
  N, A, B = map(int, input().split())
  A, B = min(A,B), max(A,B)
  if A==1:
    ans[t] = 'YES'
  elif gcd(A,B)==1:
    if N >= A+B-1:
      ans[t] = 'YES'
print(*ans, sep='\n')
0