結果

問題 No.361 門松ゲーム2
ユーザー 0w10w1
提出日時 2017-04-27 17:31:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 77,116 KB
最終ジャッジ日時 2023-10-11 16:07:37
合計ジャッジ時間 5,122 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,500 KB
testcase_01 AC 76 ms
71,332 KB
testcase_02 AC 79 ms
71,164 KB
testcase_03 AC 73 ms
71,176 KB
testcase_04 AC 75 ms
71,416 KB
testcase_05 AC 74 ms
71,304 KB
testcase_06 AC 75 ms
71,172 KB
testcase_07 AC 75 ms
71,452 KB
testcase_08 AC 90 ms
76,452 KB
testcase_09 AC 85 ms
76,300 KB
testcase_10 AC 86 ms
76,300 KB
testcase_11 AC 82 ms
76,168 KB
testcase_12 AC 87 ms
76,304 KB
testcase_13 AC 85 ms
76,536 KB
testcase_14 AC 141 ms
76,580 KB
testcase_15 AC 93 ms
76,552 KB
testcase_16 AC 153 ms
76,924 KB
testcase_17 AC 141 ms
76,936 KB
testcase_18 AC 96 ms
76,608 KB
testcase_19 AC 140 ms
76,364 KB
testcase_20 AC 91 ms
76,136 KB
testcase_21 AC 148 ms
77,044 KB
testcase_22 AC 189 ms
77,024 KB
testcase_23 AC 141 ms
76,452 KB
testcase_24 AC 143 ms
76,764 KB
testcase_25 AC 152 ms
76,924 KB
testcase_26 AC 155 ms
77,116 KB
testcase_27 AC 158 ms
76,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

L, D = map( int, input().split() )

sg = [ 0 for i in range( L + 1 ) ]
for i in range( L + 1 ):
  bag = set()
  for j in range( 1, i ):
    for k in range( j + 1, i - j ):
      l = i - j - k
      if not ( j < k < l ): continue
      if not ( l - j <= D ): continue
      bag.add( sg[ j ] ^ sg[ k ] ^ sg[ l ] )
  for j in range( 1000000 ):
    if j not in bag:
      sg[ i ] = j
      break

print( [ "matsu", "kado" ][ sg[ L ] > 0 ] )
0