結果

問題 No.1218 Something Like a Theorem
コンテスト
ユーザー mesame3993
提出日時 2021-11-18 21:28:14
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 199 ms / 2,000 ms
+ 440µs
コード長 410 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 74 ms
コンパイル使用メモリ 81,024 KB
実行使用メモリ 243,456 KB
最終ジャッジ日時 2026-10-08 16:39:20
合計ジャッジ時間 4,422 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
  from sys import stdin
  readline=stdin.readline
  n,z = map(int, readline().split())
  if n >= 3:
    print('No')
  elif n == 1:
    if z >= 2:
      print('Yes')
    else:
      print('No')
  elif n == 2:
    st = set(y*y for y in range(1, 10**6+1))
    z *= z
    for x in range(1, 10**6+1):
      x *= x
      if z-x in st:
        print('Yes')
        break
    else:
      print('No')
main()
0