AtCoder-Library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub ryusuke920/AtCoder-Library

:heavy_check_mark: Test/AOJ/ITP1/ITP1_11_C.test.py

Code

# verification-helper: PROBLEM https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_11_C&lang=ja

import sys
sys.path.append("../../../")

from Math import Dice
from random import randint

def main() -> None:

    up_1, front_1, right_1, left_1, back_1, down_1 = map(int, input().split())
    up_2, front_2, right_2, left_2, back_2, down_2 = map(int, input().split())

    # サイコロの目が 1~6 ではない場合に置き換える
    replace_dice1, replace_dice2 = {}, {}
    replace_dice1[f"{up_1}-1"], replace_dice2[f"{up_2}-1"] = 1, 1
    replace_dice1[f"{front_1}-2"], replace_dice2[f"{front_2}-2"] = 2, 2
    replace_dice1[f"{right_1}-3"], replace_dice2[f"{right_2}-3"] = 3, 3
    replace_dice1[f"{left_1}-4"], replace_dice2[f"{left_2}-4"] = 4, 4
    replace_dice1[f"{back_1}-5"], replace_dice2[f"{back_2}-5"] = 5, 5
    replace_dice1[f"{down_1}-6"], replace_dice2[f"{down_2}-6"] = 6, 6

    # 置き換えた場合に復元する用の辞書
    restoration_dice1, restoration_dice2 = {}, {}
    restoration_dice1[1], restoration_dice2[1] = up_1, up_2
    restoration_dice1[2], restoration_dice2[2] = front_1, front_2
    restoration_dice1[3], restoration_dice2[3] = right_1, right_2
    restoration_dice1[4], restoration_dice2[4] = left_1, left_2
    restoration_dice1[5], restoration_dice2[5] = back_1, back_2
    restoration_dice1[6], restoration_dice2[6] = down_1, down_2

    # u,d,f,b,l,r をそれぞれ 0,1,2,3,4,5 として state1,state2 に指定
    # value1,value2 はそれぞれ state1, state2 に対応する面の目

    dice1 = Dice.Dice(0, replace_dice1[f"{up_1}-1"], 2, replace_dice1[f"{front_1}-2"], 0, 0)
    dice2 = Dice.Dice(0, replace_dice2[f"{up_2}-1"], 2, replace_dice2[f"{front_2}-2"], 0, 0)

    check = False
    for _ in range(1000):
        p = randint(0, 3)
        if p == 0:
            dice1.RotateN()
        if p == 1:
            dice1.RotateS()
        if p == 2:
            dice1.RotateW()
        if p == 3:
            dice1.RotateE()

        is_ok = True
        for i in range(6):
            if restoration_dice1[dice1.status()[i]] != restoration_dice2[dice2.status()[i]]:
                is_ok = False
        
        if is_ok:
            check = True

    print("Yes") if check else print("No")


if __name__ == "__main__":
    main()
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page