結果

問題 No.2222 Respawn
ユーザー Shirotsume
提出日時 2023-02-14 08:18:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 77,776 KB
最終ジャッジ日時 2024-07-17 05:28:32
合計ジャッジ時間 64,838 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
import time
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
import random


n = ii()

s = input()
s += '##'
def roll():
    now = 0
    save = 0
    cnt = 0
    while True:
        c = random.choice([0, 1, 2])
        cnt += 1
        if c == 0:
            now += 1
            if s[now] == '#':
                now = save
        if c == 1:
            now += 2
            if s[now] == '#':
                now = save
        if c == 2:
            save = now
        if now == n - 1:
            return cnt

t = time.time()

cnt = 0
c = 0
while time.time() - t < 1.8:
    c += roll()
    cnt += 1
print(c / cnt)


    
0