結果
問題 | No.2708 Jewel holder |
ユーザー | 👑 tipstar0125 |
提出日時 | 2024-03-31 14:11:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 100 ms / 2,000 ms |
コード長 | 954 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 75,976 KB |
最終ジャッジ日時 | 2024-03-31 14:11:24 |
合計ジャッジ時間 | 2,098 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 35 ms
53,460 KB |
testcase_02 | AC | 36 ms
53,460 KB |
testcase_03 | AC | 35 ms
53,460 KB |
testcase_04 | AC | 34 ms
53,460 KB |
testcase_05 | AC | 34 ms
53,460 KB |
testcase_06 | AC | 37 ms
53,460 KB |
testcase_07 | AC | 34 ms
53,460 KB |
testcase_08 | AC | 48 ms
64,436 KB |
testcase_09 | AC | 43 ms
62,240 KB |
testcase_10 | AC | 49 ms
64,432 KB |
testcase_11 | AC | 67 ms
73,260 KB |
testcase_12 | AC | 36 ms
53,460 KB |
testcase_13 | AC | 70 ms
71,196 KB |
testcase_14 | AC | 37 ms
53,460 KB |
testcase_15 | AC | 57 ms
68,460 KB |
testcase_16 | AC | 40 ms
59,704 KB |
testcase_17 | AC | 100 ms
75,944 KB |
testcase_18 | AC | 77 ms
75,960 KB |
testcase_19 | AC | 79 ms
75,976 KB |
ソースコード
H,W=list(map(int,input().split())) A=[input() for _ in range(H)] ans=0 for i in range(1<<(H+W-2)): n=i.bit_count() bit=i row=0 col=0 cnt=1 ok=True for j in range(H+W-2): if (bit>>j)&1==0: if row+1>=H or A[row+1][col]=="#": ok=False break if A[row+1][col]=="x": if cnt==0: ok=False break cnt-=1 if A[row+1][col]=="o": cnt+=1 row+=1 else: if col+1>=W or A[row][col+1]=="#": ok=False break if A[row][col+1]=="x": if cnt==0: ok=False break cnt-=1 if A[row][col+1]=="o": cnt+=1 col+=1 # print(bin(bit),row,col,cnt) if ok and row==H-1 and col==W-1:ans+=1 print(ans)