結果

問題 No.1465 Archaea
ユーザー 小野寺健小野寺健
提出日時 2021-04-29 21:30:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 15,072 KB
最終ジャッジ日時 2023-09-24 21:36:21
合計ジャッジ時間 4,772 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
15,072 KB
testcase_01 AC 18 ms
7,780 KB
testcase_02 AC 22 ms
7,836 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 16 ms
7,756 KB
testcase_05 AC 16 ms
7,768 KB
testcase_06 AC 16 ms
7,820 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 16 ms
7,776 KB
testcase_10 AC 16 ms
7,828 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())

if N == 1:
    print('YES')
else:
   fw = {1}
   bw = {N}
   cnt = 0
   while True:
       nfw = set()
       for M in fw:
           if M * 2 <= N:
               nfw.add(M*2)
           if M+3 <= N:
               nfw.add(M*2)
       fw = nfw
       cnt += 1
       if len(fw & bw) > 0:
           print('YES')
           break
       elif cnt == K:
           print('NO')
           break
       nbw = set()
       for M in bw:
           if M % 2 == 0:
               nbw.add(M//2)
           if M > 3:
               nbw.add(M-3)
       bw = nbw
       cnt += 1
       if len(fw & bw) > 0:
           print('YES')
           break
       elif cnt == K:
           print('NO')
           break 
0