답안 #1090331

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1090331 2024-09-18T08:56:54 Z hahahaha Power Plant (JOI20_power) C++17
100 / 100
113 ms 28720 KB
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⡤⠤⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠛⠉⠀⠀⠀⠀⠈⠙⢷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠶⣄⡀⠀⠀⠀⢠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠀⠀⠉⠛⠶⣤⣸⡇⠀⠀⠀⠀⣀⣤⣶⣶⠒⠒⠒⠶⣬⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⠴⠶⣿⠀⠀⠀⠀⠀⠀⠈⠉⠉⠛⠒⠶⢿⣭⣀⡀⢻⡀⠀⠀⢠⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⠶⠛⠋⠁⠀⠀⢸⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠷⣴⣞⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡴⠞⠉⠀⠀⠀⠀⠀⠀⢰⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠞⠋⠀⠀⠀⠀⢀⡤⠠⡄⠀⢰⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡞⠁⠀⠀⠀⠀⣠⠖⠋⠀⣸⠇⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⢀⡀⠀⠀⠀⠀⠀⠀⢦⡀⠀⠀⠀⠸⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡼⠋⠀⠀⠀⠀⢀⣴⠋⢀⢀⡴⠋⠀⢀⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣽⠀⣼⢿⡄⠀⠀⠀⠀⣆⠀⠉⢦⡀⠀⠀⠀⠘⢧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡟⠁⠀⠀⠀⠀⣠⠟⠇⠀⠈⠉⠁⠀⣀⣾⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡟⢰⠏⠀⠻⣄⠀⠀⠀⠹⣄⣰⠟⠁⠀⠀⠀⠀⠀⢻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡟⠀⢀⣀⡖⠀⣰⠏⠀⠀⠀⠀⠀⢀⣼⣿⠋⠸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣧⡟⠀⠀⠀⠹⣦⠀⠀⠀⠀⠁⠀⣶⠀⠀⣴⠛⢧⠀⢻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣠⠞⣩⡟⠀⠀⠈⠉⠀⢀⡟⠀⠀⢀⣀⣠⣤⣾⡿⠗⠒⠚⣿⠠⣤⠀⠀⠀⠀⠀⠀⠀⢸⣿⠓⠒⠲⠶⠶⠾⢷⣤⣀⣀⠀⠀⠙⣧⠀⠹⣆⣼⠃⠀⢷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⡴⠟⢁⡼⣿⠁⠀⠀⠀⠀⠀⢸⠃⠀⠀⠈⠉⢠⡾⠋⠀⠀⠀⠀⠸⣆⠙⣧⡀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠻⣆⠉⠁⠀⠀⢹⡄⠀⠈⠁⠀⠀⠘⣷⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣠⡶⠋⢀⡴⠋⢰⡏⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⣠⠟⠀⠀⠀⠀⠀⠀⠀⢻⡄⢸⣷⣄⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⢳⣄⠀⠀⠸⣧⠀⠀⠀⠀⠀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢰⣾⡥⠴⠞⠋⠀⠀⣼⠀⠀⠀⠀⠀⠀⠀⣸⠀⠀⠀⣰⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡄⣷⠙⠷⣄⡀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢷⣄⠀⣿⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠀⢸⡄⠀⣼⢏⣀⣤⣶⣦⣤⣶⣶⣶⣶⣶⣿⣿⣾⡆⠀⠈⠻⢦⣼⡇⢰⣶⣶⣶⣶⣶⣶⣶⣤⣤⣤⣦⠙⢧⣿⠀⠀⠀⠀⠀⠀⢸⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠘⣇⣼⠏⠘⣿⡿⢿⣿⣿⣿⣿⣿⡏⠉⠉⠉⠙⠃⠀⠀⠀⠀⠉⠁⠘⠛⢻⣿⣿⣿⣿⣿⣟⠛⢛⠷⠀⠀⣿⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⡟⣷⠀⠀⠀⠀⠀⠀⠀⢻⡏⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⢰⡏⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣷⢹⣆⠀⠀⠀⠀⠀⠀⠈⣷⠀⠀⠀⠀⢹⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⣾⠀⠀⠀⠀⠀⠀⢰⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢿⠘⣿⣆⠀⠀⠀⠀⠀⠐⠘⣧⠀⠀⠀⠘⢿⣿⣿⣿⣿⠏⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⡿⠃⠀⠀⠀⣼⠃⠀⠀⠀⠀⠀⣰⠟⠐⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠸⣇⣿⠙⣧⣄⠀⠀⠀⠀⠀⠘⢧⡀⠀⠀⠈⢹⠿⢟⡋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢻⡿⠀⡀⠀⠀⣼⠃⠀⠀⠀⠀⣀⡾⠋⠀⣴⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⠀⣿⠝⠳⣤⣀⡀⠀⠀⠈⢷⣤⠇⢠⡞⠠⠾⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⠁⡾⠃⣠⡾⠃⠀⠀⣀⣤⠾⠋⠀⠀⠀⡿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣸⣿⠀⠀⠀⠉⠙⠓⡶⠦⠤⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠓⢰⡿⠤⠴⠶⣿⠉⠀⠀⠀⠀⠀⢠⡇⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⢻⠀⠀⠀⠀⠀⠃⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢲⣄⠀⠀⠀⠀⠀⠀⠀⢀⣴⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡟⠀⠀⠀⠀⠀⠀⢸⡇⣸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡿⢸⡇⠀⠀⠀⠀⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠲⠤⣤⠤⠴⠞⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠀⠀⠀⠀⠀⠀⢸⠇⠈⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡇⢸⡇⠀⠀⠀⠀⠀⢸⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡇⠀⠀⠀⠀⠀⠀⢺⢀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⢷⠛⣇⠀⠀⠀⠀⠀⠈⣿⠉⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣅⣸⠀⠀⠀⠀⠀⠀⢀⣿⢸⡀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⠘⣀⣿⠀⠀⠀⠀⠀⢷⢸⡄⠀⠈⠙⠶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡴⠟⠁⠀⠈⣿⠀⠀⠀⠀⠀⠀⠈⡟⣼⡇⠀⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡇⠀⢿⢿⠀⠀⠀⠀⠀⠀⠈⣧⠀⠀⠀⠀⠀⠉⠛⠶⢤⣤⣀⣀⠀⣀⡀⠀⠀⠀⠀⠀⢀⣠⡴⠞⠋⠁⠀⠀⠀⠀⢀⡏⠀⠀⠀⠀⠀⠀⢠⡇⢹⣤⠀⢹⡄⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠀⠀⡿⢸⡆⠀⠀⠀⠀⠀⠀⢻⡆⠀⠀⠀⠀⠀⠀⠀⠀⣿⡿⠟⠋⠉⠁⠀⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀⠀⠀⠀⠀⢸⠇⠀⠀⠀⠀⠀⠀⢸⡇⠈⣟⠀⠈⣷⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢰⡟⠀⢰⡇⠘⡇⠀⠀⠀⠀⠀⠘⠀⣷⠀⠀⠀⠀⠀⠀⠀⠀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⠆⠀⠀⠀⠀⠀⠀⣼⠁⠀⢻⡀⠀⠸⣇⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⠁⠀⣼⠁⠀⣿⠀⠀⠀⠀⠀⠀⠀⠻⣇⣀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡀⠀⠀⠀⠀⠀⠀⠀⣰⡇⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠈⣷⡀⠀⢻⡄⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢰⡇⠀⢀⡏⠀⠀⢻⠀⠀⠀⠀⠀⠀⠀⠀⢻⣦⣄⠀⠀⠀⠀⣠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣧⠀⠀⠀⠀⠀⣠⣾⣿⠀⠀⠀⠀⠀⠀⢠⣠⡇⡇⠀⠀⠸⣯⡀⠀⢷⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡾⠀⠀⣼⠁⠀⠀⠸⡇⠀⠀⠀⠀⠀⠀⠀⠀⢿⣽⡧⠴⢶⣿⣿⠖⠒⠛⠛⠃⠀⠀⠀⠚⠋⠉⠉⠉⠙⠓⠲⢾⡛⠻⣽⠃⠀⠀⠀⠀⠀⠀⢸⣿⣃⠀⠀⠀⠀⢹⣷⠀⠘⣧⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣸⠃⠀⢸⡏⠀⠀⠀⢀⣿⠀⠀⠀⠀⢀⣀⠀⠈⠈⢷⠖⠚⠋⠁⢹⡇⠀⢀⣴⠶⠶⢦⣄⣀⣤⡶⠶⠤⠤⠤⠶⠾⠇⢰⡏⠀⠀⠀⠀⠀⠀⠻⣿⣿⣤⡀⠀⠀⠀⠀⢿⣀⠀⠸⣆⠀⠀⠀
⠀⠀⠀⠀⠀⢰⠏⠀⢀⡿⠀⠀⠀⣰⠟⢹⣿⡄⠀⠀⠀⠻⣄⠀⠀⠘⣷⣤⣄⣀⣈⡙⠛⢹⡷⢶⣦⣴⣾⣛⣻⢯⣴⣦⠴⠖⠃⠀⢀⡾⠀⠀⠀⠀⠀⠀⠀⢰⣿⡇⠀⠹⣆⠀⠀⠸⡞⣧⣆⠀⠹⣄⠀⠀
⠀⠀⠀⠀⢠⡟⠀⠀⡼⠁⠀⠀⣰⠏⠀⠈⣟⣧⠀⠀⠀⠀⢻⣆⠀⠀⠈⣧⡿⠀⠈⠉⠛⠛⣻⣿⡿⢿⣿⡍⠉⠀⠀⠀⠀⠀⠀⠀⡾⠁⠀⠀⠀⢀⣴⠀⠀⡾⣿⠁⠀⠀⠘⣧⠀⠀⢿⠘⣟⠀⠀⢻⡄⠀
⠀⠀⢀⣠⡟⠀⢀⡾⠃⠀⠀⣰⡏⠀⠀⠀⣻⠘⣧⠀⠀⠀⠀⢻⣷⡄⠀⠘⢷⡀⠀⠀⠀⠀⠩⣉⠁⠈⣛⡁⠀⠀⠀⠀⠀⠀⣀⣾⠁⠀⠀⣀⣠⣟⠁⠀⣠⣤⡟⠀⠀⠀⠀⠘⣧⡄⠘⡇⠙⣇⠀⠀⠻
*/
#include <bits/stdc++.h>
using namespace std;

#define i64 long long
#define ld long double
#define bit(n,i) ((n>>i)&1)
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define FOD(i,a,b) for(int i=a; i>=b; i--)
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define __sumairu__ main()
#define die_hard_onimai_fan void seggs()
#define file(name) if(fopen(name".inp","r")){freopen(name".inp","r",stdin);freopen(name".out","w",stdout);}
#define brute(name) if(fopen(name".inp","r")){freopen(name".inp","r",stdin);freopen(name".ans","w",stdout);}
#define TIME (1.0*clock()/CLOCKS_PER_SEC)
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ai(n) array<int,n>
#define dbg(x) {cerr<<#x<<' '<<x<<endl;}
#define dbgArr(arr,n) {cerr<<#arr;FOR(_i,1,n)cerr<<' '<<(arr)[_i];cerr<<endl;}

template <typename T,typename U>
ostream& operator<<(ostream &os,pair<T,U>p){
    return os<<"{"<<p.fi<<", "<<p.se<<"}";
}
mt19937_64 rd(chrono::steady_clock::now().time_since_epoch().count());

i64 Rand(i64 l,i64 r)
{
    i64 ans=l+1ll*rd()*rd()%(r-l+1);
    assert(l<=ans&&ans<=r);
    return ans;
}
//const i64 base=1e9+7;
//const i64 mod=(1ll<<53)+5;

#define i64 long long
#define debug 0

//const int mod=1e9+7;
//const int mod=998244353;
const int inf=1e9;
///check the limits, dummy
const int N=2e5+5;

int n;
vector<int>adj[N];
bool ok[N];
int ans;
int dp[N];

void dfs(int u,int p=0)
{
    dp[u]=ok[u];

    int tot=0;
    for(auto&&v:adj[u])if(v!=p)
    {
        dfs(v,u);
        ans=max(ans,dp[v]+ok[u]);
        tot+=dp[v];
    }
    dp[u]=max(dp[u],tot-ok[u]);
    ans=max(ans,dp[u]);
}

die_hard_onimai_fan
{
    cin>>n;
    FOR(i,2,n)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    FOR(i,1,n)
    {
        char c;
        cin>>c;
        ok[i]=(c=='1');
    }
    dfs(1);
    cout<<ans;
}

__sumairu__
{
    FAST
    file("");

    int tt=1;//cin>>tt;
    while(tt--)seggs();
    cerr<<"\nTime elapsed: "<<TIME<<" s.\n";
}
/**
6
2 3
4 3
1 3
3 5
6 2
110011
*/

Compilation message

power.cpp:57:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   57 | #define __sumairu__ main()
      |                     ^~~~
power.cpp:132:1: note: in expansion of macro '__sumairu__'
  132 | __sumairu__
      | ^~~~~~~~~~~
power.cpp: In function 'int main()':
power.cpp:59:53: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 | #define file(name) if(fopen(name".inp","r")){freopen(name".inp","r",stdin);freopen(name".out","w",stdout);}
      |                                              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
power.cpp:135:5: note: in expansion of macro 'file'
  135 |     file("");
      |     ^~~~
power.cpp:59:83: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 | #define file(name) if(fopen(name".inp","r")){freopen(name".inp","r",stdin);freopen(name".out","w",stdout);}
      |                                                                            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
power.cpp:135:5: note: in expansion of macro 'file'
  135 |     file("");
      |     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Correct 2 ms 5960 KB Output is correct
3 Correct 2 ms 5724 KB Output is correct
4 Correct 2 ms 5160 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 2 ms 5096 KB Output is correct
8 Correct 2 ms 4952 KB Output is correct
9 Correct 2 ms 5724 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4952 KB Output is correct
15 Correct 2 ms 5724 KB Output is correct
16 Correct 2 ms 5724 KB Output is correct
17 Correct 2 ms 5724 KB Output is correct
18 Correct 2 ms 5156 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 3 ms 4956 KB Output is correct
21 Correct 3 ms 5720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Correct 2 ms 5960 KB Output is correct
3 Correct 2 ms 5724 KB Output is correct
4 Correct 2 ms 5160 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 2 ms 5096 KB Output is correct
8 Correct 2 ms 4952 KB Output is correct
9 Correct 2 ms 5724 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4952 KB Output is correct
15 Correct 2 ms 5724 KB Output is correct
16 Correct 2 ms 5724 KB Output is correct
17 Correct 2 ms 5724 KB Output is correct
18 Correct 2 ms 5156 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 3 ms 4956 KB Output is correct
21 Correct 3 ms 5720 KB Output is correct
22 Correct 2 ms 5980 KB Output is correct
23 Correct 3 ms 5212 KB Output is correct
24 Correct 2 ms 5212 KB Output is correct
25 Correct 2 ms 5980 KB Output is correct
26 Correct 2 ms 5972 KB Output is correct
27 Correct 2 ms 5980 KB Output is correct
28 Correct 3 ms 5212 KB Output is correct
29 Correct 2 ms 5172 KB Output is correct
30 Correct 3 ms 5208 KB Output is correct
31 Correct 3 ms 5212 KB Output is correct
32 Correct 3 ms 5048 KB Output is correct
33 Correct 2 ms 5980 KB Output is correct
34 Correct 3 ms 5212 KB Output is correct
35 Correct 2 ms 5980 KB Output is correct
36 Correct 3 ms 5140 KB Output is correct
37 Correct 3 ms 5212 KB Output is correct
38 Correct 2 ms 5212 KB Output is correct
39 Correct 3 ms 5216 KB Output is correct
40 Correct 3 ms 5980 KB Output is correct
41 Correct 3 ms 5212 KB Output is correct
42 Correct 2 ms 5172 KB Output is correct
43 Correct 3 ms 5212 KB Output is correct
44 Correct 3 ms 5212 KB Output is correct
45 Correct 3 ms 5224 KB Output is correct
46 Correct 3 ms 5212 KB Output is correct
47 Correct 3 ms 5212 KB Output is correct
48 Correct 2 ms 6000 KB Output is correct
49 Correct 3 ms 5988 KB Output is correct
50 Correct 2 ms 5988 KB Output is correct
51 Correct 3 ms 5988 KB Output is correct
52 Correct 2 ms 5988 KB Output is correct
53 Correct 3 ms 5916 KB Output is correct
54 Correct 2 ms 5980 KB Output is correct
55 Correct 2 ms 5976 KB Output is correct
56 Correct 3 ms 5212 KB Output is correct
57 Correct 3 ms 5208 KB Output is correct
58 Correct 3 ms 6232 KB Output is correct
59 Correct 2 ms 5980 KB Output is correct
60 Correct 2 ms 5976 KB Output is correct
61 Correct 3 ms 5212 KB Output is correct
62 Correct 3 ms 5164 KB Output is correct
63 Correct 2 ms 5212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5724 KB Output is correct
2 Correct 2 ms 5960 KB Output is correct
3 Correct 2 ms 5724 KB Output is correct
4 Correct 2 ms 5160 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 5724 KB Output is correct
7 Correct 2 ms 5096 KB Output is correct
8 Correct 2 ms 4952 KB Output is correct
9 Correct 2 ms 5724 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4952 KB Output is correct
15 Correct 2 ms 5724 KB Output is correct
16 Correct 2 ms 5724 KB Output is correct
17 Correct 2 ms 5724 KB Output is correct
18 Correct 2 ms 5156 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 3 ms 4956 KB Output is correct
21 Correct 3 ms 5720 KB Output is correct
22 Correct 2 ms 5980 KB Output is correct
23 Correct 3 ms 5212 KB Output is correct
24 Correct 2 ms 5212 KB Output is correct
25 Correct 2 ms 5980 KB Output is correct
26 Correct 2 ms 5972 KB Output is correct
27 Correct 2 ms 5980 KB Output is correct
28 Correct 3 ms 5212 KB Output is correct
29 Correct 2 ms 5172 KB Output is correct
30 Correct 3 ms 5208 KB Output is correct
31 Correct 3 ms 5212 KB Output is correct
32 Correct 3 ms 5048 KB Output is correct
33 Correct 2 ms 5980 KB Output is correct
34 Correct 3 ms 5212 KB Output is correct
35 Correct 2 ms 5980 KB Output is correct
36 Correct 3 ms 5140 KB Output is correct
37 Correct 3 ms 5212 KB Output is correct
38 Correct 2 ms 5212 KB Output is correct
39 Correct 3 ms 5216 KB Output is correct
40 Correct 3 ms 5980 KB Output is correct
41 Correct 3 ms 5212 KB Output is correct
42 Correct 2 ms 5172 KB Output is correct
43 Correct 3 ms 5212 KB Output is correct
44 Correct 3 ms 5212 KB Output is correct
45 Correct 3 ms 5224 KB Output is correct
46 Correct 3 ms 5212 KB Output is correct
47 Correct 3 ms 5212 KB Output is correct
48 Correct 2 ms 6000 KB Output is correct
49 Correct 3 ms 5988 KB Output is correct
50 Correct 2 ms 5988 KB Output is correct
51 Correct 3 ms 5988 KB Output is correct
52 Correct 2 ms 5988 KB Output is correct
53 Correct 3 ms 5916 KB Output is correct
54 Correct 2 ms 5980 KB Output is correct
55 Correct 2 ms 5976 KB Output is correct
56 Correct 3 ms 5212 KB Output is correct
57 Correct 3 ms 5208 KB Output is correct
58 Correct 3 ms 6232 KB Output is correct
59 Correct 2 ms 5980 KB Output is correct
60 Correct 2 ms 5976 KB Output is correct
61 Correct 3 ms 5212 KB Output is correct
62 Correct 3 ms 5164 KB Output is correct
63 Correct 2 ms 5212 KB Output is correct
64 Correct 62 ms 15188 KB Output is correct
65 Correct 62 ms 15208 KB Output is correct
66 Correct 58 ms 15184 KB Output is correct
67 Correct 59 ms 15032 KB Output is correct
68 Correct 59 ms 15056 KB Output is correct
69 Correct 62 ms 15176 KB Output is correct
70 Correct 62 ms 15184 KB Output is correct
71 Correct 60 ms 15188 KB Output is correct
72 Correct 59 ms 15212 KB Output is correct
73 Correct 70 ms 27772 KB Output is correct
74 Correct 87 ms 27720 KB Output is correct
75 Correct 63 ms 14932 KB Output is correct
76 Correct 54 ms 14876 KB Output is correct
77 Correct 66 ms 14928 KB Output is correct
78 Correct 60 ms 15100 KB Output is correct
79 Correct 60 ms 14928 KB Output is correct
80 Correct 57 ms 14936 KB Output is correct
81 Correct 48 ms 15304 KB Output is correct
82 Correct 82 ms 15264 KB Output is correct
83 Correct 63 ms 20304 KB Output is correct
84 Correct 71 ms 22356 KB Output is correct
85 Correct 113 ms 22100 KB Output is correct
86 Correct 65 ms 16388 KB Output is correct
87 Correct 58 ms 15952 KB Output is correct
88 Correct 64 ms 16204 KB Output is correct
89 Correct 61 ms 16212 KB Output is correct
90 Correct 68 ms 16100 KB Output is correct
91 Correct 64 ms 16380 KB Output is correct
92 Correct 81 ms 16636 KB Output is correct
93 Correct 86 ms 18972 KB Output is correct
94 Correct 87 ms 20684 KB Output is correct
95 Correct 64 ms 19580 KB Output is correct
96 Correct 86 ms 17748 KB Output is correct
97 Correct 75 ms 16028 KB Output is correct
98 Correct 72 ms 15536 KB Output is correct
99 Correct 61 ms 15448 KB Output is correct
100 Correct 67 ms 18500 KB Output is correct
101 Correct 68 ms 16668 KB Output is correct
102 Correct 56 ms 15952 KB Output is correct
103 Correct 59 ms 15584 KB Output is correct
104 Correct 40 ms 15776 KB Output is correct
105 Correct 90 ms 24400 KB Output is correct
106 Correct 43 ms 15812 KB Output is correct
107 Correct 39 ms 15776 KB Output is correct
108 Correct 67 ms 28500 KB Output is correct
109 Correct 44 ms 15812 KB Output is correct
110 Correct 75 ms 28720 KB Output is correct
111 Correct 59 ms 14928 KB Output is correct