Submission #1359457

#TimeUsernameProblemLanguageResultExecution timeMemory
1359457tamerrShops (NOI24_shops)C++20
0 / 100
112 ms43820 KiB
/*
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⡟⠛⠛⠋⠉⠉⠉⠉⠛⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠍⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠙⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠫⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠄⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠥⡍⡴⡃⠄⠒⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⢀⠀⡀⡐⠼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠁⠞⢼⢁⢇⠀⣄⠀⠀⠀⠀⠀⠀⠀⢠⠈⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⢈⠔⠨⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢏⠈⠐⠁⠅⢱⠊⡈⢩⡡⠀⠆⠁⠀⠀⠠⠐⠁⠀⢀⠀⠓⠀⠀⠀⢠⡀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠈⠑⠺⠛⢽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠐⠀⠀⠀⠀⠂⣯⡋⠁⠁⠀⠁⠀⠀⢄⠀⠈⢧⠄⠀⠀⠀⢀⠐⣀⠠⠔⢊⡔⡀⣄⡀⠀⠈⢶⠆⣠⡀⢸⡔⠣⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⢀⠀⠈⠐⠄⢢⣴⣿⣦⣚⣂⡐⠌⢕⠀⡹⡀⡠⡀⠢⠔⠀⠐⠄⢘⣀⣩⣵⠒⡐⡟⠡⠀⡀⠠⢒⡈⢺⢝⣟⡐⡙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⡟⠀⢀⠝⠀⠁⡈⣐⣽⣿⣿⣿⣟⣠⠰⣅⣢⣞⣡⣱⡮⠉⡠⢠⣀⣵⣾⣿⣿⣿⣿⣔⣶⡌⢲⣳⣬⠥⣎⣃⢋⢋⣿⣶⡨⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⡇⠁⠀⢀⡢⠈⠉⠉⠉⠃⢛⢑⠛⠃⡦⡰⣋⣼⣌⣹⣁⣪⣾⣶⣿⣿⣿⣿⣿⣿⣿⣿⡟⡁⢘⣺⣗⡌⣼⡛⢾⣿⣿⣿⣿⣧⣥⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⡇⠀⣠⣔⠕⠀⢀⠂⠀⡀⠀⠙⠤⠴⡒⠛⣿⣿⠟⠁⠙⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣽⣽⠄⢁⣅⡌⠁⣨⣝⡹⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⡇⠀⣶⢍⠄⠠⠀⠖⠀⠀⡀⠀⠀⡀⠉⢄⣟⡇⠁⠀⠀⠪⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣿⡿⣡⡜⡜⡇⣾⣿⣿⣿⢹⣿⣿⣿⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⡇⣹⢿⡝⡆⡔⢁⠀⡆⠙⠡⠄⠀⠈⠀⠁⠘⣿⠀⠀⠀⠈⡙⠻⣿⣿⣿⣿⣿⣿⣿⣿⠟⣃⡬⣾⠐⠁⣴⣿⣿⣿⣇⣆⣿⣿⣾⢏⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣧⡘⠚⠁⡘⠀⢐⡖⢁⡖⠻⠠⣦⡁⠒⢨⣤⣿⠆⡀⡔⢀⠃⠀⡀⢁⢉⠌⠉⠀⠰⠐⣶⠻⢡⡟⠉⣰⣿⣿⣿⣿⣿⣧⣏⠛⠙⠿⠽⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣯⠗⠌⠰⠀⢲⠃⠹⡝⠁⣃⣴⣿⠎⠜⠉⠐⠀⠀⠀⠀⠈⠠⠀⡱⣶⣮⣐⢈⡭⠆⣍⠶⠌⢧⠘⣾⣿⣿⣿⣿⣿⡏⡿⣘⢱⠭⠄⢿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣟⡌⠰⠑⠀⠀⠆⡐⡠⣚⣾⠟⠀⠀⠑⠀⠀⠀⠀⠀⠩⢄⢀⠨⢶⠽⢨⣅⠛⢓⣥⡒⣨⠂⠀⡘⣿⣷⣿⣿⣿⣿⡗⡟⢻⢨⡣⣿⡌⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⡸⣌⢭⣦⣱⣦⢰⣦⣌⢁⢲⡴⣀⣐⣀⡀⠀⠀⠀⠀⠏⠘⣶⣤⡀⠚⡯⠻⣏⢫⡟⢿⢀⢢⠱⠈⢛⡻⢿⡟⠿⡥⣃⡭⠤⢺⢽⢑⢽⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠻⣬⢋⠻⣿⣾⣿⣿⣾⣮⣧⣿⣿⣿⣷⣆⣤⡴⣦⣄⣐⣉⣙⠑⢄⢱⡂⢛⢜⡃⠈⠈⠘⡦⣒⠜⠗⢘⠧⢴⠷⢯⣃⣠⣾⣾⣮⣾⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⣋⢆⠒⠾⣿⣿⣿⣻⣿⣿⣿⣿⣿⢛⣛⣿⣿⣿⣧⣿⣿⡟⢮⠡⠈⢆⢈⢠⠋⡙⡇⢄⣉⠃⣧⡄⢳⡸⢌⢫⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣌⠣⢡⠴⠹⢟⣶⣿⣽⣿⣿⣯⣽⣿⣿⡟⣻⣿⣿⣿⣿⡆⡼⢡⢣⣂⡇⠾⠇⠙⠃⡸⡌⢅⡑⠃⣀⠳⠡⠘⠶⠉⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢚⢄⠋⣹⣿⡇⣹⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣜⣼⡋⣄⣤⣶⣬⢷⣶⠇⢿⡟⠳⣾⢫⠻⡾⠛⣶⠳⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣎⡲⣠⡑⢻⣆⣟⠿⢻⣿⡏⠘⣿⣿⣿⣿⣿⣿⣻⠛⡻⢿⠋⢿⠙⡯⠠⣿⠈⠸⡇⡁⣫⢹⠀⡿⠃⢸⢩⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣧⡘⢧⡛⢛⣭⢪⢾⣿⣿⣯⣿⣿⣿⣷⣾⣿⣶⣾⣶⣿⣶⣿⣷⣿⣷⣾⣿⣶⣾⣿⣾⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡧⢀⠠⢿⡇⠉⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸⠐⢠⡆⡈⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⢐⡌⠑⡃⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⡏⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡽⢈⠠⠐⣆⠘⣻⣿⢋⣫⠽⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢂⠁⠄⠺⡄⠓⣹⣷⣇⢀⡞⡹⠿⢿⢿⣿⣿⣿⣿⡯⣽⣿⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡗⡂⠐⢀⠀⠁⣄⠐⠌⢍⠙⠳⡦⣿⡄⡟⢉⡏⠛⣹⢛⣿⠟⡟⢿⣩⡇⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣐⣐⠀⠀⠀⠈⢧⠜⠚⠕⠚⡄⢭⢙⠳⠿⣧⣶⠿⠦⡿⠾⠯⡿⠼⠷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠟⠂⠈⣯⢰⡅⡄⠏⠹⢁⠁⠂⠤⡄⡶⢰⡂⢯⠻⣟⢙⣋⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣢⠄⡺⢧⡸⠘⣤⢠⠆⠈⠀⣁⡳⢦⡜⡃⢉⠻⣎⠄⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣴⡀⠈⢃⠙⢤⠑⡆⡀⢇⢹⣏⢻⠃⠺⣇⡸⣘⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣄⡀⠀⠨⠃⠙⡼⠵⠺⠃⠀⠐⠈⠉⠃⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣤⣄⣀⣀⣀⣠⣴⣦⣬⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
*/
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl "\n"
#define int ll
#define ff first
#define ss second
#define pb push_back
#define all(v) v.begin(),v.end()
const int sz = 5e5 + 9;	
const int oo = 1e18 + 7;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
int phi(int n){
    int res=n;
    for(int i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
            n/=i;
            res-=res/i;
        }
    }   
    if(n>1)
    res-=res/n;
    return res;
}
int binpow(int x, int y,int MOD){
    if(!y) return 1;
    int res = binpow(x, y / 2,MOD);
    if(y % 2 == 1) 
    return (((res%MOD)*(res%MOD))%MOD)*(x%MOD)%MOD;
    return ((res%MOD)*(res%MOD))%MOD;
}
int inv(int n){
    return binpow(n,mod-2,mod);
}
int gcd(int a, int b) {
    if (b == 0)
    return a;
    return gcd(b, a % b); 
}
// vector<int>prime;
// vector<bool>primes(sz, true);
// void sieve()
// {
//     primes[0] = primes[1] = false;
//     for(int i = 2; i * i < sz; i++){
//         if(primes[i] == false)
//             continue;
//         for(int j = i * i; j < sz; j += i)
//         primes[j] = false;
//     }
//     for(int i = 0; i < sz; i++){
//         if(primes[i] == true)
//             prime.push_back(i);
//     }
// }
vector<vector<pair<int,int>>>g(sz);
void solve(){
    int n,m;
    cin>>n>>m;
    vector<int>mini(n+1,oo);
    while(m--)
    {
        int a,b,w;
        cin>>a>>b>>w;
        g[a].pb({b,w});
        g[b].pb({a,w});
        mini[a]=min(mini[a],w);
        mini[b]=min(mini[b],w);
    }
    vector<int>clr(n+1,-1);
    queue<int>q;
    int ans=0;
    q.push(1);
    clr[1]=0;
    while(!q.empty())
    {
        int u=q.front();
        q.pop();
        for(auto [v,w] : g[u])
        {
            if(clr[v]==-1)
            {
                clr[v]=clr[u]^1;
                q.push(v);
            }
        }
    }
    for(int i=1;i<=n;i++)
    ans=max(ans,mini[i]);
    cout<<ans<<endl;
    for(int i=1;i<=n;i++)
    {
        if(clr[i])
        cout<<'B';
        else
        cout<<'D';
    }
    cout<<endl;
}
signed main()
{
    speed;
    int tt=1; 
    // cin >> tt;
    while(tt--)
    {    
       solve();
    }
    return 0;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...