제출 #1317348

#제출 시각아이디문제언어결과실행 시간메모리
1317348huseynahmadli2010KOVANICE (COI15_kovanice)C++20
50 / 100
1468 ms55024 KiB
// Uh, is this okay? At this distance, you've got nothing but weak spots! // Too slow, too slow /* ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⠴⠚⠋⠉⠉⠈⠉⠐⠒⢵⡑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠖⢋⠅⠀⠀⠀⠀⣀⣠⠀⠀⠀⠀⠀⢹⡾⢔⠦⠯⢭⣵⠦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⡀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠴⠊⠁⠠⠈⠀⠀⠀⣠⡲⠟⠁⠀⠀⠀⡠⡀⠑⢤⠧⠀⠀⠀⠀⠈⠙⠦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⠶⠶⠒⠛⠛⠛⠛⠋⠛⠛⠛ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠊⣁⡤⠂⠀⣠⠀⠀⡠⠞⠁⠀⠀⡀⠀⠀⠀⠙⠺⣦⣀⠳⡎⠠⠖⠠⢄⠀⠀⠀⠙⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⠾⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢔⣩⣶⡿⠋⠀⢀⠜⠀⢠⠊⠀⠀⠀⢠⠞⠁⡀⠀⠀⠀⠀⠘⢿⡅⠀⠀⠀⢀⠈⠱⣤⡀⠀⠐⣽⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠋⡩⠊⠀⠀⢀⠎⠀⡴⠁⠀⠀⠀⠰⠁⡠⠊⠀⠀⣠⠄⠀⢦⣬⡓⠀⠀⠀⠀⠑⠄⠀⠛⠄⠀⠀⠫⢧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠋⠀⢀⠞⠁⠀⠀⢀⠎⢀⠄⠀⠀⠀⠀⠀⢀⢜⠁⠀⡠⠚⠀⢀⠄⡄⢯⢚⠄⠀⠀⢠⠀⠈⢟⡄⠈⡄⠀⠀⠘⣧⡑⠤⣀⠀⡀⠀⠀⠀⠀⢀⣴⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡔⠁⠀⠀⡰⠋⠀⠀⠀⢀⡎⠀⡌⠀⠀⠀⠀⠀⣼⡫⠃⡠⠊⠀⠀⢠⠋⣼⣟⣶⣛⣤⢦⡀⠀⠑⡄⠀⠻⡄⡘⡄⠀⠀⠸⣿⡍⠊⠉⠁⠀⠀⠀⣠⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣔⡏⠀⠀⠀⡜⠁⡀⠀⠀⢠⢺⠀⣸⠀⠀⠀⠀⠐⢸⠟⢀⠜⠀⠀⢀⢄⢃⡼⠉⠈⠉⠉⠛⠋⠹⣆⢄⠸⡀⠀⠰⡁⠘⡄⠐⡄⢹⣾⡄⠀⠀⠀⠀⢠⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⡸⠀⠀⢀⡜⢀⡾⠁⠀⢠⢃⠆⢀⡿⠀⠀⠀⠀⢀⠇⣠⠟⠁⠀⠠⢃⠎⡼⠁⠀⠀⠀⠀⠀⠀⠀⠹⣮⢂⣿⠀⠀⢱⢡⢱⠀⠰⡆⡟⣇⠀⠀⠀⠀⣸⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡎⠀⢧⠀⢀⡎⠠⡿⠁⠀⢠⢃⠎⠀⣸⠃⠀⠀⠀⠀⡸⠰⠋⠀⠀⡰⢡⡞⣼⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣏⢿⡇⠀⠀⡇⢇⢣⠀⠸⢸⢸⠀⠀⠀⢠⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⡎⠁⠀⡞⢀⣾⠁⠀⢀⠃⡼⠀⠀⡟⠀⠀⠀⢀⠆⡴⠁⢀⠔⠊⣠⣻⡳⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣎⣧⢸⠀⢹⡜⡌⠆⠀⣿⠀⠇⠀⠀⣸⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⢠⣾⣿⠀⠀⠎⡸⡏⠀⠰⠁⠀⠀⠀⣸⢠⠃⣠⠏⢀⣼⡵⡽⠁⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠐⠒⠂⢿⣼⠈⡄⢸⡿⣵⡸⡄⣿⡀⠀⠀⠀⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⡞⢸⡇⠀⠀⢠⣾⡇⠀⢸⠀⠀⠀⠀⡇⢸⢪⡜⢡⣾⢫⠊⠀⠀⠀⠀⠀⠀⠀⢠⣶⠋⠁⠀⠀⠀⠀⠀⣿⠀⠃⠀⣷⡏⢱⢱⡏⢳⡄⠀⠀⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣷⠃⢸⡇⢀⠇⢎⡟⠀⠀⡆⠀⠀⠀⠀⡇⡼⠊⣴⣿⠗⠁⠀⠀⠀⠀⠀⠀⢀⣴⠟⠑⠂⠉⠁⠁⠒⠢⠄⢻⡆⠆⠀⣿⡸⢸⣀⢿⠀⠉⠁⠈⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⢸⡇⡜⡀⣾⢰⠀⠀⡇⢀⠀⠀⢈⠁⣧⠼⠛⠋⠛⠻⡷⣄⠀⠀⠀⠀⠘⠡⢀⣀⠤⣤⣶⣶⣶⢶⣾⡟⡇⡇⠀⣸⣷⣫⠟⣘⢦⠀⠀⠀⠈⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⢇⢡⣻⢷⢸⠀⠀⡇⠘⠀⠀⢸⠀⣧⣤⣤⣤⣠⠤⠼⣈⢢⠀⠀⠀⠠⣎⢵⣾⣿⣿⡻⣿⠇⣼⡿⠀⡇⡇⠀⢼⢣⢿⡀⢿⣿⠷⡄⠀⠀⠈⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢸⢸⡇⢸⣘⡄⠀⡇⠀⡄⠀⠀⠁⡟⠻⣿⣟⣿⣿⢷⠇⠀⠀⠀⠀⠀⠉⠛⠁⢨⠿⠾⠁⠚⠉⠀⢀⢧⡟⠀⣾⡟⣎⣇⢻⡍⢢⡀⠀⠀⠀⠀⠉⠛⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠳⡄⠻⡇⢀⣿⠀⢧⠀⠀⡌⣷⡦⠽⠶⠖⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡸⡟⠀⣏⢹⡌⢿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢛⣿⡿⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⢸⢻⡄⢸⡀⠀⢷⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣷⢃⡇⡼⣣⡗⣽⢣⡿⣿⠖⠴⠃⠀⠀⠀⠀⢀⣤⣶⡿⡿⠿⠟⠿⢷⣶⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠃⢧⡸⣧⡀⢸⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡼⠁⣼⣿⢯⣽⡻⡼⣳⣽⢾⡝⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠛⠻⠷⠶⠶⢶⣤⣶⣴⣦⣴ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⢉⣷⣄⣳⠉⠁⠀⠀⠀⠀⠀⠀⠢⡀⠀⣠⡦⠀⠀⠀⠀⠀⠀⠠⠊⠀⣰⣿⣿⡱⢾⣿⢷⣭⣺⢻⣯⣄⣀⠀⢀⣠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣄⣀⡼⢋⣾⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠁⠀⠀⠀⠀⣠⡶⠂⠀⠀⣴⣿⣎⣿⢹⡿⣽⢿⣾⣟⢿⡾⣯⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣤⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢦⢴⣱⡯⢸⣯⢿⣦⣄⠀⠀⠓⠦⠄⣤⡤⠴⠒⠒⣲⡶⠛⠁⠀⠀⢀⣼⣿⣿⣽⣧⡿⣽⣻⣏⣿⢿⣗⠛⠾⠒⠒⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⠿⠿⠿⠿⢿⣿⠿⠿⠛⠛⠒⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⣩⠟⢠⣾⢹⣿⣿⣯⣷⣄⡀⠀⠀⠀⠉⠉⠉⠁⠀⠀⠀⠀⠀⣠⡿⣟⣿⣿⠝⠀⣿⡿⣷⢾⣹⣟⣿⣷⡀⠀⠀⠀⠀⠀⠀⢀⣠⡴⠚⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣞⡢⢜⡿⠛⣷⣹⣿⣿⣷⣾⠟⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⣠⡞⣯⣇⣿⣿⣇⢀⣀⣝⣿⣿⣿⣷⣿⣾⣿⣿⣶⣴⣶⣶⢾⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣟⣿⣿⣿⢣⡿⣿⣦⣀⠀⠀⢀⣠⣾⡏⣱⣿⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⢀⡤⠖⢲⢄⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢧⢽⣿⣷⡿⣼⣠⣽⡏⣿⢻⠟⡽⢰⣿⣷⢿⣿⣿⡿⣿⣿⡿⣿⣿⣿⣿⡍⠉⢉⠉⠉⠉⠈⠻⣿⣿⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠁⠈⢉⡵⣫⠾⣁⢞⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⣿⢿⠻⣿⢧⣷⠏⣸⣸⣗⡟⠉⠀⣼⡿⢿⣿⣾⣿⡿⠿⠟⠛⠛⠉⠉⠉⣧⡀⠀⠀⠀⠘⣟⢿⣿⣷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⡞⢩⠖⠁⠀⢀⡜⠀⠀⢠⡤⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⣠⠞⢹⡛⢷⣼⣟⣻⣿⣏⡁⠀⠀⠀⢰⣿⠤⠜⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⣄⣀⠀⠀⠘⠀⠛⣿⠈⠙⠛⠶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⡜⢠⠃⠀⠀⢀⡞⠀⠀⢠⠏⠧⢼⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠁⠀⠀⣇⠀⠙⢟⢿⣯⣹⣿⡆⠀⢰⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣴⣶⣿⣿⣷⣶⣒⣲⣄⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⡵⠁⠀⠀⢀⡞⠀⠀⠀⡞⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣰⠆⠀⠀⠀⠀⠀⠀⣱⡀⠀⢀⣿⠀⠀⠿⠁⠈⠉⠀⠀⢀⡿⠀⠀⠀⠀⠀⠀⣀⣠⣤⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⣧⠀⠀⡰⢹⠁⠀⠀⢸⠁⠀⠀⡾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠷⠒⠿⠃⠀⢀⣤⡀⣤⣠⣾⣿⣧⣀⡎⢹⡄⠀⠀⠀⠀⠀⠀⢠⣾⡇⠀⣀⢠⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⣿⠀⠀⠃⠸⡄⠀⠀⡏⠀⠀⡞⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣠⡽⠃⠀⠰⣿⣯⣿⣿⣿⣿⣿⡿⢿⠃⠀⠁⠀⠀⠀⠀⠀⡴⣫⣾⣶⣿⣇⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣤⣤⣤⣤⣄⣀⣀ ⠻⡆⠀⠀⠀⡇⠀⡸⠀⠀⠀⢹⠀⠀⠀⢀⡤⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⡀⠸⣿⣿⣧⣴⣶⣾⣿⣿⣿⣿⣿⣿⡿⠋⢐⣼⣿⣶⣄⠀⠀⣀⣤⣾⣿⣿⣿⣿⣿⣿⣆⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⠠⡇⠀⠀⠀⢸⣤⠃⠀⠀⠀⣸⠀⢠⠞⢩⣯⠟⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣤⣾⣿⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⢴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠭⢀⣀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⠂⢃⠀⠀⢀⣀⠚⠀⠀⠀⢀⣯⠞⠁⢠⢳⠎⠀⠀⠀⠀⠀⠀⠀⣰⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⢁⣠⣴⣾⣄⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠋⣉⣵⣾⢿⣿⡄⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟ ⡉⠈⢢⠀⡜⠋⠐⣦⠀⠀⡾⣽⠀⠀⣎⡎⠀⠀⠀⠀⣴⠂⠀⢀⣿⣯⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⣀⣤⣾⡿⣯⣟⡿⣽⣷⡄⠈⠻⢿⣿⣿⠟⠛⠉⢀⣤⣶⣻⣟⡿⣽⣻⢾⣽⡄⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠁⢠ ⢮⣉⡐⢣⠃⠀⠀⠛⠀⡞⠀⠸⢷⡠⡿⠀⠀⠀⠀⠘⣻⡆⠀⢨⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⢁⣠⣶⡿⢿⣽⣳⣟⡷⣯⣟⡿⣽⡿⣷⣔⡠⠊⢀⣠⣴⣾⣿⣻⣞⣷⣻⣽⢷⣻⣟⡾⣿⡀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⢀⣴⣿ ⡄⣒⠤⠭⢗⣒⡀⠀⠠⠇⠀⠀⠈⢷⡇⠀⠀⠀⠀⠀⠋⠁⣠⣿⣿⣿⣿⣿⣿⣿⡿⠋⢁⣤⣾⣟⡿⣝⣿⣻⣞⡷⣯⢟⡷⣯⣟⣷⣿⣿⣿⢿⣿⣿⣻⢯⣷⣻⣵⣻⣞⢷⣯⣿⢿⣽⡷⣟⣷⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⣰⣿⣿⣿ ⢿⣄⠈⠁⢚⣒⠠⠤⠼⠂⠀⠀⠀⢸⠃⠀⠀⠀⠀⢠⣤⣷⣿⣿⣿⣿⣿⣿⣿⠋⢀⣴⡿⣿⣹⡾⣽⣻⣞⡷⣯⢿⡽⣯⣟⡷⣿⣽⣾⡟⣾⢯⣷⣯⡿⣟⣟⢿⣳⣿⣿⣿⡷⣿⢯⣿⣽⡿⣽⣧⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⢀⣾⣿⣿⠿⢿ ⢸⠻⣧⣘⠣⠤⠛⣛⣣⠤⢠⡀⠀⡜⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⣠⣿⣿⣻⣟⣧⣿⣧⡿⣼⢿⣻⣟⡿⣧⣟⡿⣧⢿⣼⡻⣟⡿⢧⣟⣿⣿⣿⡼⣿⣟⣿⣧⡻⢿⣻⣿⣼⣿⡿⣿⣄⠀⢿⣿⣿⣿⣿⡿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⣼⣿⣿⣿⣿⣿ ⢸⠀⠐⠪⠒⠽⠥⠶⠖⠤⠓⠀⢸⡄⠀⠀⣀⣀⣼⣿⣿⣿⣿⣿⣿⣿⡟⢡⣾⣿⢻⣼⣿⣾⣿⣿⣿⡿⣽⣫⡷⣯⢿⣳⣯⡿⣯⣟⡾⣽⢯⡿⣟⣯⣿⣿⡿⣿⡷⢿⣿⣹⣷⣯⣿⣳⣯⣷⣻⣯⢿⣆⠈⢻⣿⡿⠋⠀⠀⠀⠈⠉⠛⠛⠛⠛⠛⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⣸⣿⣿⡿⠟⠛⠻ ⢸⠀⠀⠀⠀⠀⠀⠀⠠⢄⠀⠀⢸⠃⠀⣾⣟⣽⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣳⢯⣿⣟⣿⣯⣿⣽⡷⣯⢿⡽⣯⢿⡽⣟⣾⣿⣏⣿⠇⣿⣿⣿⣿⣿⢯⣷⣻⣞⡷⣿⣻⢿⣧⣠⠋⠀⠐⢉⣭⣀⣀⣀⣀⣀⣀⣤⠶⠤⢌⣁⡑⠋⠙⠭⡿⢿⣿⣿⣿⣯⣤⣤⣿⣿⣿⣀⣀⣀⣀ ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⠦⢠⠋⠀⠀⣽⠇⠀⠉⠻⣿⣿⣿⣿⣿⣿⢿⣳⡿⣿⣿⣿⣿⣿⣿⣿⣿⢯⣟⣿⣳⣿⣿⢿⣟⡧⣿⣟⣯⣟⡷⣯⢿⣯⣟⣿⣿⣿⢸⣿⣿⣯⣿⣾⡻⣞⡷⣯⣟⣯⡿⣿⡏⠀⠀⢀⡴⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠦⠤⠈⠉⠩⠵⡽⣷⣶⡷⠾⣿⣿⣿⣤⡀⠀⢠⣄⣫ ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡏⢀⣠⣿⣿⣷⣦⡀⠀⠀⠻⣿⣿⣿⣿⣻⡽⣟⡷⣯⢿⣹⢯⣟⡿⣽⣟⣿⣿⣿⣿⢿⣿⢓⣿⣿⣟⡾⣽⣻⣽⡿⣽⣞⡿⣯⣿⡾⢿⣻⣟⡷⣫⢿⣽⣻⣯⡿⣽⢿⣽⢇⡤⠚⠁⠀⠐⠉⣉⣀⠤⠤⠤⢤⣤⠤⠒⠉⠉⠉⢒⡒⡤⢤⣶⣿⣿⡻⠶⣷⣦⢿⣿⡟⢿⣿⣛⣿ ⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡗⠛⠛⠻⢿⣿⣿⣿⣦⡀⠀⠘⢿⣿⣿⣷⣻⢯⡿⣽⣻⣏⡿⣽⣻⣽⣻⣾⠟⣠⡙⠿⡿⡾⠿⠗⢿⣟⡷⣯⢷⣟⣯⢿⣽⣷⣍⣵⣿⡻⣞⣽⢯⡿⣞⣷⣯⢿⣟⣿⣿⠋⠀⠀⣀⣤⣶⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⠋⠥⠠⠤⠥⠿⣿⣻⠿⣿⣿⣏⠓⠈⠻⢿⠿ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠙⢿⣿⣿⣷⡄⠀⢸⣿⣿⣿⣽⣯⣟⡿⣵⣯⣿⣽⣿⣾⣿⣿⣸⣿⣿⣿⣿⣿⣿⡿⣸⣯⡿⣽⣻⢾⣻⣽⢾⣳⡿⣽⢾⡽⣽⣞⣿⣽⢿⡾⣟⣯⣿⠋⡡⢇⣴⣾⣿⠟⠁⠀⠐⢉⣩⣤⣤⣤⡴⠤⠤⣤⠴⠋⠁⠀⠀⣠⣴⠆⠀⠈⠉⠛⠉⠉⠉⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⡄⣾⣿⣿⢠⣬⡙⣾⣽⡟⢳⣿⢾⣻⣿⣯⣟⣿⣿⠏⡌⣷⣿⡿⣿⣟⣯⡿⣽⢯⡿⣽⣞⡿⣽⣻⡽⣾⣽⣳⣟⣿⣾⣿⣿⣿⣿⣿⣬⣶⡿⣿⡾⠃⠀⠀⣀⣴⣿⣿⣿⡿⡯⠔⠒⠉⠀⠀⠀⠀⠀⠚⡑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣴ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡌⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣷⡇⣾⡿⢃⣿⡿⠁⢸⣟⡟⢁⣤⡌⣻⣿⡿⠀⢰⣿⣯⣿⢯⠟⣾⡽⣯⠿⠽⢷⣛⣾⠷⢯⣻⣽⣾⣿⣻⣟⡷⣿⣞⣷⣯⣿⣻⣽⡿⠟⡲⠀⣠⣾⣿⣿⣿⣿⡿⠋⢁⡠⢄⣀⠠⠤⠒⠒⠉⠉⠉⠉⠉⠉⠉⠙⠛⠓⠛⠛⠋⠉⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡿⢹⡿⣿⢠⣤⡔⣿⡿⢁⡇⣻⣯⡇⠻⣿⣷⢿⣻⡇⢀⣿⣟⣾⣽⠋⠀⣯⣿⡇⣸⣶⡆⢹⡟⢠⣶⡄⢹⣾⢯⣷⢯⣟⣷⣻⡷⣯⣷⣿⢿⣷⡮⠤⢊⣿⣿⣿⣿⡿⡿⠁⠀⢁⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⠁⢸⣿⡇⣼⣿⠇⣿⢃⣚⡃⣟⣿⣿⣦⠘⢯⣿⣽⠀⣸⣿⣞⣯⠇⣼⠀⡿⣾⠀⢿⡿⢃⣼⠇⣾⣿⡇⢸⣯⣟⣾⣟⡿⣾⡵⣿⣽⣾⣯⠿⠛⠁⢠⣿⣿⣿⣿⠟⣹⢤⠀⣰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡆⠀⠀⠀⠀⠀⠀⠀⣰⡇⠀⢸⣿⣧⣭⣥⣾⣃⣾⡽⡇⣿⡀⣿⣿⠃⣼⣿⡟⢀⣿⣟⣾⠏⣐⣛⠀⣟⡏⢰⣶⠰⣟⡿⢰⣿⣽⠃⣿⣳⣟⣾⢯⣟⣯⡿⣷⠝⠉⢀⣠⣴⣶⣿⣿⣿⣿⠋⣴⡥⢊⡴⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢧⠀⠀⠀⠀⠀⣀⢴⣿⡇⠀⣺⣿⢯⣿⡿⣽⢯⣷⣻⣷⡿⣷⢦⣴⣾⣿⣿⡇⣼⣿⣳⡏⣰⡿⣿⠀⣯⠁⣟⣾⠐⣿⠃⣼⣷⠃⣼⣿⣻⢾⣽⣟⢾⡳⠟⠁⣠⣶⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣎⠔⠄⠰⠪⠛⣩⣿⣿⠃⠀⣿⣿⡿⢯⣟⣷⣻⣞⣷⡿⣝⣯⣻⣝⣾⣳⣿⣰⣿⣳⣯⣟⡿⣝⣯⣻⡟⣾⣛⢾⢦⡿⣤⣥⡴⣿⣛⣾⣽⣻⢾⡽⠋⢀⣠⣾⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ */ #include <bits/stdc++.h> using namespace std; #define int long long const int sz=1e6+5; const int INF=1e18; const int MOD=1e9+7; int par[sz],s[sz]; map<int,int> mp; vector<int> graph[sz]; vector<int> rev_graph[sz]; bool visited[sz]; int dpth[sz]; int n,m,k; int findpar(int u) { if(u==par[u]) return u; par[u]=findpar(par[u]); mp[par[u]]=max(mp[par[u]],mp[u]); return par[u]; } bool cmp(int a,int b) { return (rev_graph[findpar(a)].size()<rev_graph[findpar(b)].size()); } void dfs(int v,int d) { dpth[v]=d; visited[v]=true; for(int to : graph[v]) if(!visited[to]) dfs(to,d+1); } void rev_dfs(int v) { visited[v]=true; mp[v]=dpth[v]; for(int to : rev_graph[v]) if(!visited[to] && (dpth[to]==(dpth[v]-1))) rev_dfs(to); } void unite(int u,int v) { u=findpar(u); v=findpar(v); if(s[u]<s[v]) swap(u,v); s[u]+=s[v]; par[v]=u; mp[u]=max(mp[u],mp[v]); } void solve() { cin>>n>>m>>k; for(int i=1;i<=m;i++) { par[i]=i; s[i]=1; } vector<pair<int,int>> not_equals; for(int i=0;i<k;i++) { string s; cin>>s; int a,b,ind=0; string sub1="",sub2=""; for(int j=0;j<s.size();j++) { if(s[j]=='>' || s[j]=='<' || s[j]=='=') { ind=j; break; } sub1+=s[j]; } a=stoi(sub1); for(int j=ind+1;j<s.size();j++) sub2+=s[j]; b=stoi(sub2); if(s[ind]=='=') { if(findpar(a)!=findpar(b)) unite(a,b); } else if(s[ind]=='<') not_equals.push_back({a,b}); else not_equals.push_back({b,a}); } for(int i=0;i<not_equals.size();i++) { int a=not_equals[i].first,b=not_equals[i].second; a=findpar(a); b=findpar(b); graph[a].push_back(b); rev_graph[b].push_back(a); } vector<int> v; for(int i=1;i<=m;i++) v.push_back(i); sort(v.begin(),v.end(),cmp); for(int i=0;i<m;i++) if(!visited[findpar(v[i])]) dfs(findpar(v[i]),1); for(int i=1;i<=m;i++) visited[i]=false; for(int i=1;i<=m;i++) if(dpth[findpar(i)]==n && !visited[findpar(i)]) rev_dfs(findpar(i)); for(int i=1;i<=m;i++) { if(mp[findpar(i)]==0) cout<<'?'<<endl; else cout<<'K'<<mp[findpar(i)]<<endl; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while(t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...