結果

問題 No.1004 サイコロの実装 (2)
ユーザー integerinteger
提出日時 2020-05-02 15:59:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,133 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 81,432 KB
最終ジャッジ日時 2023-08-28 20:10:50
合計ジャッジ時間 6,492 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
75,664 KB
testcase_01 AC 69 ms
71,296 KB
testcase_02 AC 68 ms
71,256 KB
testcase_03 AC 69 ms
71,044 KB
testcase_04 AC 68 ms
71,248 KB
testcase_05 AC 68 ms
71,296 KB
testcase_06 AC 68 ms
71,232 KB
testcase_07 AC 69 ms
71,500 KB
testcase_08 AC 69 ms
71,308 KB
testcase_09 AC 68 ms
71,144 KB
testcase_10 AC 69 ms
71,268 KB
testcase_11 AC 69 ms
71,464 KB
testcase_12 AC 70 ms
71,196 KB
testcase_13 AC 69 ms
71,196 KB
testcase_14 AC 68 ms
71,048 KB
testcase_15 AC 69 ms
71,284 KB
testcase_16 AC 84 ms
76,072 KB
testcase_17 AC 80 ms
76,168 KB
testcase_18 AC 72 ms
71,368 KB
testcase_19 AC 80 ms
76,156 KB
testcase_20 AC 79 ms
75,944 KB
testcase_21 AC 91 ms
76,860 KB
testcase_22 AC 81 ms
75,956 KB
testcase_23 AC 78 ms
76,036 KB
testcase_24 AC 88 ms
76,872 KB
testcase_25 AC 88 ms
76,860 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

class Player:
    def __init__(self, name):
        self.name = name
        self.black = 0
        self.white = 0
        self.pos = 0
    def forward(self, x):
        self.pos += x
        if self.pos % 2:
            self.black += 1
        else:
            self.white += 1
    def getpoint(self):
        return min(self.black, self.white)

def main():
    a, b, x0, n = map(int, input().split())
    ans = solve(a, b, x0, n)
    print(*ans)

def solve(a, b, x, n):
    m = 2 ** 32 - 1
    takahashi, aoki = Player('takahashi'), Player('aoki')
    for _ in range(n):
        x = rand(a, b, x, m)
        takahashi.forward(saikoro(x))
        x = rand(a, b, x, m)
        aoki.forward(saikoro(x))
    return takahashi.getpoint(), aoki.getpoint()

def rand(a, b, x, m):
    return (a * x + b) & m

def saikoro(x):
    return x % 6 + 1

def test():
    n = 4
    a, b, x0, m= map(int, input('a b x0 m\n').split())
    x = [x0 for _ in range(n * 2 + 1)]
    for i in range(n * 2):
        x[i + 1] = rand(a, b, x[i], m)
    print(*['x{}:{}'.format(i, x) for i, x in enumerate(x)], sep = '\n')

if __name__ == '__main__':
    main()
0