QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#786770#6313. 人员调度sumairu100 ✓1868ms110136kbC++2319.1kb2024-11-26 23:20:272024-11-26 23:20:41

Judging History

你现在查看的是最新测评结果

  • [2024-11-26 23:20:41]
  • 评测
  • 测评结果:100
  • 用时:1868ms
  • 内存:110136kb
  • [2024-11-26 23:20:27]
  • 提交

answer

/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⡤⠤⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠛⠉⠀⠀⠀⠀⠈⠙⢷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠶⣄⡀⠀⠀⠀⢠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠀⠀⠉⠛⠶⣤⣸⡇⠀⠀⠀⠀⣀⣤⣶⣶⠒⠒⠒⠶⣬⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⠴⠶⣿⠀⠀⠀⠀⠀⠀⠈⠉⠉⠛⠒⠶⢿⣭⣀⡀⢻⡀⠀⠀⢠⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⠶⠛⠋⠁⠀⠀⢸⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠷⣴⣞⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡴⠞⠉⠀⠀⠀⠀⠀⠀⢰⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠞⠋⠀⠀⠀⠀⢀⡤⠠⡄⠀⢰⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡞⠁⠀⠀⠀⠀⣠⠖⠋⠀⣸⠇⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⢀⡀⠀⠀⠀⠀⠀⠀⢦⡀⠀⠀⠀⠸⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡼⠋⠀⠀⠀⠀⢀⣴⠋⢀⢀⡴⠋⠀⢀⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣽⠀⣼⢿⡄⠀⠀⠀⠀⣆⠀⠉⢦⡀⠀⠀⠀⠘⢧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡟⠁⠀⠀⠀⠀⣠⠟⠇⠀⠈⠉⠁⠀⣀⣾⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡟⢰⠏⠀⠻⣄⠀⠀⠀⠹⣄⣰⠟⠁⠀⠀⠀⠀⠀⢻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡟⠀⢀⣀⡖⠀⣰⠏⠀⠀⠀⠀⠀⢀⣼⣿⠋⠸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣧⡟⠀⠀⠀⠹⣦⠀⠀⠀⠀⠁⠀⣶⠀⠀⣴⠛⢧⠀⢻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣠⠞⣩⡟⠀⠀⠈⠉⠀⢀⡟⠀⠀⢀⣀⣠⣤⣾⡿⠗⠒⠚⣿⠠⣤⠀⠀⠀⠀⠀⠀⠀⢸⣿⠓⠒⠲⠶⠶⠾⢷⣤⣀⣀⠀⠀⠙⣧⠀⠹⣆⣼⠃⠀⢷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⡴⠟⢁⡼⣿⠁⠀⠀⠀⠀⠀⢸⠃⠀⠀⠈⠉⢠⡾⠋⠀⠀⠀⠀⠸⣆⠙⣧⡀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠻⣆⠉⠁⠀⠀⢹⡄⠀⠈⠁⠀⠀⠘⣷⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣠⡶⠋⢀⡴⠋⢰⡏⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⣠⠟⠀⠀⠀⠀⠀⠀⠀⢻⡄⢸⣷⣄⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠈⢳⣄⠀⠀⠸⣧⠀⠀⠀⠀⠀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢰⣾⡥⠴⠞⠋⠀⠀⣼⠀⠀⠀⠀⠀⠀⠀⣸⠀⠀⠀⣰⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡄⣷⠙⠷⣄⡀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢷⣄⠀⣿⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠀⢸⡄⠀⣼⢏⣀⣤⣶⣦⣤⣶⣶⣶⣶⣶⣿⣿⣾⡆⠀⠈⠻⢦⣼⡇⢰⣶⣶⣶⣶⣶⣶⣶⣤⣤⣤⣦⠙⢧⣿⠀⠀⠀⠀⠀⠀⢸⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠘⣇⣼⠏⠘⣿⡿⢿⣿⣿⣿⣿⣿⡏⠉⠉⠉⠙⠃⠀⠀⠀⠀⠉⠁⠘⠛⢻⣿⣿⣿⣿⣿⣟⠛⢛⠷⠀⠀⣿⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⡟⣷⠀⠀⠀⠀⠀⠀⠀⢻⡏⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⢰⡏⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣷⢹⣆⠀⠀⠀⠀⠀⠀⠈⣷⠀⠀⠀⠀⢹⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⣾⠀⠀⠀⠀⠀⠀⢰⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢿⠘⣿⣆⠀⠀⠀⠀⠀⠐⠘⣧⠀⠀⠀⠘⢿⣿⣿⣿⣿⠏⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⡿⠃⠀⠀⠀⣼⠃⠀⠀⠀⠀⠀⣰⠟⠐⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠸⣇⣿⠙⣧⣄⠀⠀⠀⠀⠀⠘⢧⡀⠀⠀⠈⢹⠿⢟⡋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢻⡿⠀⡀⠀⠀⣼⠃⠀⠀⠀⠀⣀⡾⠋⠀⣴⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⠀⣿⠝⠳⣤⣀⡀⠀⠀⠈⢷⣤⠇⢠⡞⠠⠾⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⠁⡾⠃⣠⡾⠃⠀⠀⣀⣤⠾⠋⠀⠀⠀⡿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣸⣿⠀⠀⠀⠉⠙⠓⡶⠦⠤⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠓⢰⡿⠤⠴⠶⣿⠉⠀⠀⠀⠀⠀⢠⡇⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⢻⠀⠀⠀⠀⠀⠃⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢲⣄⠀⠀⠀⠀⠀⠀⠀⢀⣴⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡟⠀⠀⠀⠀⠀⠀⢸⡇⣸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡿⢸⡇⠀⠀⠀⠀⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠲⠤⣤⠤⠴⠞⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠀⠀⠀⠀⠀⠀⢸⠇⠈⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡇⢸⡇⠀⠀⠀⠀⠀⢸⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡇⠀⠀⠀⠀⠀⠀⢺⢀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⢷⠛⣇⠀⠀⠀⠀⠀⠈⣿⠉⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣅⣸⠀⠀⠀⠀⠀⠀⢀⣿⢸⡀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⠘⣀⣿⠀⠀⠀⠀⠀⢷⢸⡄⠀⠈⠙⠶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡴⠟⠁⠀⠈⣿⠀⠀⠀⠀⠀⠀⠈⡟⣼⡇⠀⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡇⠀⢿⢿⠀⠀⠀⠀⠀⠀⠈⣧⠀⠀⠀⠀⠀⠉⠛⠶⢤⣤⣀⣀⠀⣀⡀⠀⠀⠀⠀⠀⢀⣠⡴⠞⠋⠁⠀⠀⠀⠀⢀⡏⠀⠀⠀⠀⠀⠀⢠⡇⢹⣤⠀⢹⡄⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠀⠀⡿⢸⡆⠀⠀⠀⠀⠀⠀⢻⡆⠀⠀⠀⠀⠀⠀⠀⠀⣿⡿⠟⠋⠉⠁⠀⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀⠀⠀⠀⠀⢸⠇⠀⠀⠀⠀⠀⠀⢸⡇⠈⣟⠀⠈⣷⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢰⡟⠀⢰⡇⠘⡇⠀⠀⠀⠀⠀⠘⠀⣷⠀⠀⠀⠀⠀⠀⠀⠀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⠆⠀⠀⠀⠀⠀⠀⣼⠁⠀⢻⡀⠀⠸⣇⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⠁⠀⣼⠁⠀⣿⠀⠀⠀⠀⠀⠀⠀⠻⣇⣀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡀⠀⠀⠀⠀⠀⠀⠀⣰⡇⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠈⣷⡀⠀⢻⡄⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢰⡇⠀⢀⡏⠀⠀⢻⠀⠀⠀⠀⠀⠀⠀⠀⢻⣦⣄⠀⠀⠀⠀⣠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣧⠀⠀⠀⠀⠀⣠⣾⣿⠀⠀⠀⠀⠀⠀⢠⣠⡇⡇⠀⠀⠸⣯⡀⠀⢷⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡾⠀⠀⣼⠁⠀⠀⠸⡇⠀⠀⠀⠀⠀⠀⠀⠀⢿⣽⡧⠴⢶⣿⣿⠖⠒⠛⠛⠃⠀⠀⠀⠚⠋⠉⠉⠉⠙⠓⠲⢾⡛⠻⣽⠃⠀⠀⠀⠀⠀⠀⢸⣿⣃⠀⠀⠀⠀⢹⣷⠀⠘⣧⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣸⠃⠀⢸⡏⠀⠀⠀⢀⣿⠀⠀⠀⠀⢀⣀⠀⠈⠈⢷⠖⠚⠋⠁⢹⡇⠀⢀⣴⠶⠶⢦⣄⣀⣤⡶⠶⠤⠤⠤⠶⠾⠇⢰⡏⠀⠀⠀⠀⠀⠀⠻⣿⣿⣤⡀⠀⠀⠀⠀⢿⣀⠀⠸⣆⠀⠀⠀
⠀⠀⠀⠀⠀⢰⠏⠀⢀⡿⠀⠀⠀⣰⠟⢹⣿⡄⠀⠀⠀⠻⣄⠀⠀⠘⣷⣤⣄⣀⣈⡙⠛⢹⡷⢶⣦⣴⣾⣛⣻⢯⣴⣦⠴⠖⠃⠀⢀⡾⠀⠀⠀⠀⠀⠀⠀⢰⣿⡇⠀⠹⣆⠀⠀⠸⡞⣧⣆⠀⠹⣄⠀⠀
⠀⠀⠀⠀⢠⡟⠀⠀⡼⠁⠀⠀⣰⠏⠀⠈⣟⣧⠀⠀⠀⠀⢻⣆⠀⠀⠈⣧⡿⠀⠈⠉⠛⠛⣻⣿⡿⢿⣿⡍⠉⠀⠀⠀⠀⠀⠀⠀⡾⠁⠀⠀⠀⢀⣴⠀⠀⡾⣿⠁⠀⠀⠘⣧⠀⠀⢿⠘⣟⠀⠀⢻⡄⠀
⠀⠀⢀⣠⡟⠀⢀⡾⠃⠀⠀⣰⡏⠀⠀⠀⣻⠘⣧⠀⠀⠀⠀⢻⣷⡄⠀⠘⢷⡀⠀⠀⠀⠀⠩⣉⠁⠈⣛⡁⠀⠀⠀⠀⠀⠀⣀⣾⠁⠀⠀⣀⣠⣟⠁⠀⣠⣤⡟⠀⠀⠀⠀⠘⣧⡄⠘⡇⠙⣇⠀⠀⠻
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define i64 long long
#define ld long double
#define ull unsigned long long
#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__ signed 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) {cout<<#x<<' '<<x<<endl;}
#define dbgF(arr,l,r) {cout<<#arr;FOR(_i,l,r)cout<<' '<<(arr)[_i];cout<<endl;}
#define dbgArr(arr,n) {cout<<#arr;FOR(_i,1,n)cout<<' '<<(arr)[_i];cout<<endl;}
#define el '\n'

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+rd()%(r-l+1);
    assert(l<=ans&&ans<=r);
    return ans;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
//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;
const i64 infl=1e18;
///check the limits, dummy
const int N=2e5+5;

int TC;
int n,k,q;
vector<int>adj[N];
vector<ai(3)>save;
multiset<int>s[N];
int v[N],w[N];
int sz[N];

//void dfsz(int u)
//{
//    sz[u]=1;
//    for(int v:adj[u])
//    {
//        dfsz(v);
//        sz[u]+=sz[v];
//    }
//}

//namespace brute
//{
//    int val[N];
//    priority_queue<int,vector<int>,greater<int>>pq[N];
//    int cal()
//    {
//        FOR(i,1,n)
//        {
//            for(int x:s[i])pq[i].push(x);
//        }
//        auto dfs=[&](auto&&dfs,int u)->void{
//            for(int v:adj[u])
//            {
//                dfs(dfs,v);
//                if(sz(pq[u])<sz(pq[v]))swap(pq[u],pq[v]);
//                while(sz(pq[v]))
//                {
//                    pq[u].push(pq[v].top());
//                    pq[v].pop();
//                }
//            }
//            while(sz(pq[u])>sz[u])pq[u].pop();
//        };
//        dfs(dfs,1);
//
//        int ans=0;
//        while(sz(pq[1]))ans+=pq[1].top(),pq[1].pop();
//        return ans;
//    }
//    void solve()
//    {
//        FOR(i,1,k)s[v[i]].insert(w[i]);
//        cout<<cal()<<el;
//
//        for(auto&&[op,u,W]:save)
//        {
//            if(op==1)
//            {
//                k++;
//                v[k]=u,w[k]=W;
//                s[v[k]].insert(w[k]);
//            }
//            else s[v[u]].erase(s[v[u]].find(w[u]));
//            cout<<cal()<<el;
//        }
//    }
//}

namespace full
{
    int head[N],heavy[N],par[N];
    void dfs(int u,int p=0)
    {
        sz[u]=1;
        par[u]=p;
        for(int v:adj[u])if(v!=p)
        {
            dfs(v,u);
            sz[u]+=sz[v];
            if(sz[v]>sz[heavy[u]])heavy[u]=v;
        }
    }

    int in[N],out[N],timer,cnt,seq[N];
    void hld(int u,int h=1)
    {
        head[u]=h;
        in[u]=++timer;
        seq[timer]=u;
        if(heavy[u])hld(heavy[u],h);
        for(int v:adj[u])if(v!=par[u]&&v!=heavy[u])
        {
            hld(v,v);
        }
        out[u]=timer;
    }

    namespace Tval
    {
        pii t[N*4];
        multiset<int>s[N*4];
        void up(int id,int l,int r,int p,pii v)
        {
            if(p>r||p<l)return;
            if(l==r)
            {
                t[id]=v;
                return;
            }
            int m=(l+r)/2;
            up(id*2,l,m,p,v);
            up(id*2+1,m+1,r,p,v);
            t[id]=min(t[id*2],t[id*2+1]);
        }
        pii get(int id,int l,int r,int x,int y)
        {
            if(x>r||y<l)return {inf,inf};
            if(x<=l&&r<=y)return t[id];
            int m=(l+r)/2;
            return min(get(id*2,l,m,x,y),get(id*2+1,m+1,r,x,y));
        }

        void add(int x,int v)
        {
            s[x].insert(v);
            int mn=*s[x].begin();
            up(1,1,n,in[x],{mn,x});
        }
        void del(int x,int v)
        {
            s[x].erase(s[x].find(v));
            int mn=(sz(s[x])?*s[x].begin():inf);
            up(1,1,n,in[x],{mn,x});
        }
    };

    namespace Tsz
    {
        pii t[N*4];
        int lz[N*4];
        void build(int id,int l,int r)
        {
            if(l==r)
            {
                t[id]={sz[seq[l]],-l};
                return;
            }
            int m=(l+r)/2;
            build(id*2,l,m);
            build(id*2+1,m+1,r);
            t[id]=min(t[id*2],t[id*2+1]);
        }
        void apply(int id,int v)
        {
            t[id].fi+=v;
            lz[id]+=v;
        }
        void push(int id)
        {
            if(!lz[id])return;
            apply(id*2,lz[id]);
            apply(id*2+1,lz[id]);
            lz[id]=0;
        }
        void up(int id,int l,int r,int x,int y,int v)
        {
            if(x>r||y<l)return;
            if(x<=l&&r<=y)
            {
                apply(id,v);
                return;
            }
            push(id);
            int m=(l+r)/2;
            up(id*2,l,m,x,y,v);
            up(id*2+1,m+1,r,x,y,v);
            t[id]=min(t[id*2],t[id*2+1]);
        }
        pii get(int id,int l,int r,int x,int y)
        {
            if(x>r||y<l)return {inf,inf};
            if(x<=l&&r<=y)return t[id];
            push(id);
            int m=(l+r)/2;
            return min(get(id*2,l,m,x,y),get(id*2+1,m+1,r,x,y));
        }
    };

    pii get(int u)
    {
        pii ans={inf,inf};
        while(u)
        {
            chmin(ans,Tsz::get(1,1,n,in[head[u]],in[u]));
            u=par[head[u]];
        }
        return ans;
    }

    i64 ans=0;
    void add(int u,int x)
    {
//        cout<<"add "<<u<<' '<<x<<el;
        ans+=x;
        Tval::add(u,x);
        while(u)
        {
            Tsz::up(1,1,n,in[head[u]],in[u],-1);
            u=par[head[u]];
        }
    }
    void del(int u,int x)
    {
//        cout<<"del "<<u<<' '<<x<<el;
        ans-=x;
        Tval::del(u,x);
        while(u)
        {
            Tsz::up(1,1,n,in[head[u]],in[u],1);
            u=par[head[u]];
        }
    }

    namespace off
    {
        vector<pii>t[N*4];
        void up(int id,int l,int r,int x,int y,pii v)
        {
//            cout<<id<<' '<<l<<' '<<r<<el;
            if(x>r||y<l)return;
            if(x<=l&&r<=y)
            {
//                cout<<"offline up" <<pii(l,r)<<' '<<v<<el;
                t[id].pb(v);
                return;
            }
            int m=(l+r)/2;
            up(id*2,l,m,x,y,v);
            up(id*2+1,m+1,r,x,y,v);
        }

        vector<ai(3)>op;
        void rollback(int sz)
        {
            while(sz(op)>sz)
            {
                auto [o,u,val]=op.back();
                if(o)del(u,val);
                else add(u,val);
                op.pop_back();
            }
        }

        void solve(int id,int l,int r)
        {
            int sz=sz(op);
//            cout<<"!!! "<<pii(l,r)<<el;
            for(auto&&[u,val]:t[id])
            {
                auto [mn,pos]=get(u);
//                cout<<u<<' '<<val<<' '<<pii(mn,pos)<<el;
                if(mn!=0)
                {
                    add(u,val);
                    op.pb({1,u,val});
                }
                else
                {
                    pos=-pos;
                    auto [xval,v]=Tval::get(1,1,n,in[seq[pos]],out[seq[pos]]);
                    if(xval<val)
                    {
                        del(v,xval);
                        add(u,val);
                        op.pb({0,v,xval});
                        op.pb({1,u,val});
                    }
                }
//                FOR(i,1,n)cout<<Tsz.get(1,1,n,in[i],in[i])<<' ';
//                cout<<el;
            }
            if(l==r)
            {
                cout<<ans<<el;
                rollback(sz);
                return;
            }

            int m=(l+r)/2;
            solve(id*2,l,m);
            solve(id*2+1,m+1,r);
            rollback(sz);
        }
    };

    int st[N];
    void solve()
    {
        dfs(1);
        hld(1);

        FOR(i,1,4*n)Tval::t[i]={inf,inf};
        Tsz::build(1,1,n);

//        dbgArr(in,n);

        int curTime=0;
        for(auto&&[op,u,W]:save)
        {
            curTime++;
            if(op==1)
            {
                k++;
                v[k]=u,w[k]=W;
                st[k]=curTime;
            }
            else
            {
                off::up(1,0,q,st[u],curTime-1,{v[u],w[u]});
                st[u]=-1;
            }
        }
        FOR(i,1,k)if(st[i]!=-1)off::up(1,0,q,st[i],q,{v[i],w[i]});
//        cout<<"! "<<q<<el;
        off::solve(1,0,q);
    }
}

die_hard_onimai_fan
{
    cin>>n>>k>>q;
    FOR(i,2,n)
    {
        int p;
        cin>>p;
        adj[p].pb(i);
    }
    FOR(i,1,k)cin>>v[i]>>w[i];
    FOR(i,1,q)
    {
        int op;
        cin>>op;
        if(op==1)
        {
            int u,w;
            cin>>u>>w;
            save.pb({op,u,w});
        }
        else
        {
            int u;
            cin>>u;
            save.pb({op,u,-1});
        }
    }
//    brute::solve();
    full::solve();
}

__sumairu__
{
    FAST
    file("cum");

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

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 2
Accepted
time: 3ms
memory: 63364kb

input:

1
6 6 6
1 2 3 2 3
1 52078
2 3759
1 85897
6 14295
3 47290
3 93702
1 2 41269
1 5 79793
1 6 88324
1 1 88307
1 4 64229
1 3 18664

output:

297021
334531
400029
447084
488101
500252
500252

result:

ok 7 numbers

Test #2:

score: 2
Accepted
time: 4ms
memory: 61308kb

input:

2
9 6 6
1 1 2 1 5 4 5 2
2 28610
4 62909
9 44990
8 38352
8 97403
4 91172
1 7 77724
1 5 73030
1 1 74599
1 2 11376
1 9 41281
1 5 52692

output:

325084
339899
412929
487528
487528
487528
540220

result:

ok 7 numbers

Test #3:

score: 2
Accepted
time: 6ms
memory: 61268kb

input:

2
9 6 6
1 2 3 4 4 1 3 2
2 43265
6 10749
4 75789
5 17017
3 68560
5 61211
1 1 82982
2 5
2 1
2 7
1 7 30320
2 6

output:

259574
342556
273996
230731
147749
178069
133875

result:

ok 7 numbers

Test #4:

score: 2
Accepted
time: 6ms
memory: 63376kb

input:

3
16 66 66
1 1 2 3 4 6 6 6 5 5 5 1 1 9 10
6 17077
6 78264
13 58368
15 52835
7 36607
9 43555
5 89936
15 55777
13 44137
1 66172
8 89009
2 1318
2 63845
8 93573
13 11924
15 74580
14 20835
6 9184
14 75018
16 94155
10 48597
5 41484
4 87492
14 9932
16 21740
13 4298
7 76915
3 81689
7 3064
7 9149
1 21961
6 1...

output:

1266121
1266121
1266121
1266121
1266121
1284726
1284726
1284726
1284726
1284726
1284726
1284726
1284726
1284726
1284726
1284726
1284726
1284726
1261079
1261079
1261079
1261079
1261079
1261079
1242276
1224701
1239267
1239267
1224701
1208538
1208538
1208538
1214706
1188250
1176898
1176898
1195695
1195...

result:

ok 67 numbers

Test #5:

score: 2
Accepted
time: 8ms
memory: 61336kb

input:

3
16 66 66
1 2 3 4 5 6 7 8 8 8 8 4 4 7 8
4 17274
9 14926
1 1389
15 21673
6 63249
7 25469
7 58444
5 16209
10 14761
2 74416
10 89493
11 85483
6 60737
16 97844
15 68483
5 86467
13 46164
4 12404
11 77651
10 32071
6 61761
6 82399
2 3843
13 76772
5 60099
8 56289
10 96527
4 43558
15 48089
1 63015
7 35381
4...

output:

1405383
1410463
1410463
1410463
1410463
1410463
1406819
1393470
1393470
1393470
1393470
1393470
1393470
1393470
1377057
1377057
1377057
1399071
1399071
1399071
1399071
1399071
1399071
1399071
1399071
1377120
1377120
1377120
1377120
1401176
1401176
1379303
1379303
1379303
1379303
1379303
1359256
1349...

result:

ok 67 numbers

Test #6:

score: 2
Accepted
time: 12ms
memory: 63416kb

input:

4
66 66 0
1 2 3 1 4 5 6 8 7 10 9 12 11 14 15 13 16 18 17 19 21 20 23 24 22 26 26 26 26 26 26 26 26 26 26 26 26 26 25 25 25 25 25 25 25 25 25 25 25 25 25 28 45 17 28 3 19 19 18 46 42 35 20 7 55
39 82261
51 30803
13 11540
7 22146
43 43489
49 85871
31 55374
6 74182
50 11205
39 808
66 8446
27 38250
5 77...

output:

2611984

result:

ok 1 number(s): "2611984"

Test #7:

score: 2
Accepted
time: 8ms
memory: 63268kb

input:

4
66 66 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 24 7 12 3 6 19 28 45 30 18 10 50 34 58 13 63 62
64 66408
38 81306
38 76367
14 63364
13 25358
56 52456
59 22480
54 1586
32 88869
61 70293
36 63360
51 48806
...

output:

2817954

result:

ok 1 number(s): "2817954"

Test #8:

score: 2
Accepted
time: 11ms
memory: 61344kb

input:

4
66 66 0
1 2 1 4 5 3 6 8 9 7 10 11 12 13 15 14 17 18 16 19 20 21 23 22 24 25 25 25 25 25 25 25 25 25 25 25 25 25 26 26 26 26 26 26 26 26 26 26 26 26 26 15 15 23 28 20 2 42 48 51 16 7 19 58 47
31 89942
65 66178
14 46664
27 60218
4 92822
45 64969
10 11089
56 28103
45 79709
15 21700
48 87186
1 99586
4...

output:

2963026

result:

ok 1 number(s): "2963026"

Test #9:

score: 2
Accepted
time: 18ms
memory: 61616kb

input:

5
2333 2333 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

102630666

result:

ok 1 number(s): "102630666"

Test #10:

score: 2
Accepted
time: 8ms
memory: 61616kb

input:

5
2333 2333 0
1 1 2 3 5 4 6 8 7 10 11 12 13 14 15 9 16 17 19 20 18 21 22 23 25 26 27 28 29 30 24 31 32 33 35 36 34 37 39 38 41 42 40 44 43 45 47 48 49 50 51 52 46 54 53 55 57 56 59 58 60 61 63 64 65 62 67 66 68 69 70 72 73 71 74 75 77 78 76 80 81 82 83 84 79 86 85 88 89 90 87 91 93 94 92 95 97 98 96...

output:

97653563

result:

ok 1 number(s): "97653563"

Test #11:

score: 2
Accepted
time: 11ms
memory: 63676kb

input:

5
2333 2333 0
1 2 1 4 5 6 7 3 9 8 11 10 12 14 13 16 17 15 19 18 20 21 23 22 24 26 25 28 27 29 31 30 33 32 34 36 37 38 35 39 40 42 43 41 45 46 47 44 48 49 51 50 53 54 52 55 56 58 57 59 60 62 61 64 65 63 67 68 66 70 71 69 72 73 74 76 77 75 78 80 79 82 83 81 84 85 86 88 87 89 91 92 93 94 90 96 97 98 95...

output:

96687896

result:

ok 1 number(s): "96687896"

Test #12:

score: 2
Accepted
time: 147ms
memory: 88512kb

input:

6
100000 100000 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

5007624082

result:

ok 1 number(s): "5007624082"

Test #13:

score: 2
Accepted
time: 168ms
memory: 87216kb

input:

6
100000 100000 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

4984117401

result:

ok 1 number(s): "4984117401"

Test #14:

score: 2
Accepted
time: 134ms
memory: 86824kb

input:

6
100000 100000 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

4996416696

result:

ok 1 number(s): "4996416696"

Test #15:

score: 2
Accepted
time: 156ms
memory: 81344kb

input:

7
100000 100000 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

4401773488

result:

ok 1 number(s): "4401773488"

Test #16:

score: 2
Accepted
time: 199ms
memory: 78172kb

input:

7
100000 100000 0
1 1 2 3 5 4 7 8 6 9 10 11 13 14 15 12 17 18 19 20 16 21 23 22 24 25 27 28 29 26 31 30 33 32 34 36 37 35 38 40 39 41 43 42 44 45 46 47 48 49 51 50 52 53 55 54 57 58 59 60 56 62 63 61 64 66 67 68 69 70 65 71 73 72 75 74 76 77 79 80 81 82 83 78 84 86 85 87 88 89 91 92 93 90 94 95 97 9...

output:

4274252146

result:

ok 1 number(s): "4274252146"

Test #17:

score: 2
Accepted
time: 170ms
memory: 82608kb

input:

7
100000 100000 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

4409489220

result:

ok 1 number(s): "4409489220"

Test #18:

score: 2
Accepted
time: 211ms
memory: 76408kb

input:

7
100000 100000 0
1 1 3 2 4 6 5 7 9 8 10 11 12 13 15 14 17 18 16 19 20 21 23 24 22 26 25 28 29 27 31 32 33 34 35 30 37 36 39 40 38 42 43 41 44 45 46 47 49 48 50 51 52 53 54 56 57 55 59 60 61 58 63 62 65 66 64 67 69 70 71 68 72 74 73 76 75 78 79 80 77 82 81 83 85 84 86 87 89 88 91 90 93 94 95 96 97 9...

output:

4269079003

result:

ok 1 number(s): "4269079003"

Test #19:

score: 2
Accepted
time: 19ms
memory: 64140kb

input:

8
2333 2333 2333
1 1 2 3 4 5 6 8 7 9 10 11 12 14 13 16 15 18 17 20 19 22 23 21 24 26 25 28 29 27 31 30 33 32 35 36 37 38 39 34 41 42 43 40 45 44 47 48 46 50 51 49 52 54 55 53 57 56 59 60 61 62 63 58 64 66 65 67 68 69 70 72 71 74 73 75 77 76 78 79 81 82 80 83 85 86 87 84 88 90 89 92 91 94 93 96 97 98...

output:

99979267
100054337
100122653
100122653
100146948
100163747
100231801
100281851
100324742
100379011
100414062
100474086
100493991
100493991
100514107
100578193
100653878
100653878
100689857
100689857
100728819
100811328
100822223
100919488
101017548
101017548
101068090
101147990
101214127
101214127
1...

result:

ok 2334 numbers

Test #20:

score: 2
Accepted
time: 19ms
memory: 62092kb

input:

8
2333 2333 2333
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...

output:

104491980
104545093
104560893
104560893
104598723
104635982
104713085
104752228
104752228
104808338
104813847
104843792
104885555
104885555
104914555
104943031
104990685
104990685
104990685
104994921
104994921
105082493
105082493
105117287
105162830
105171938
105171938
105171938
105240478
105240478
...

result:

ok 2334 numbers

Test #21:

score: 2
Accepted
time: 27ms
memory: 64132kb

input:

8
2333 2333 2333
1 1 3 4 2 5 7 8 6 9 10 12 13 14 15 11 17 18 19 16 20 22 21 24 23 25 26 27 29 30 28 31 33 32 35 34 37 36 39 38 40 41 43 42 45 44 47 46 49 48 50 51 52 53 55 56 54 57 58 59 60 62 61 64 63 66 67 65 68 70 69 72 71 74 73 76 75 78 79 80 77 81 83 84 82 85 87 86 89 88 91 90 92 93 95 94 96 97...

output:

98368021
98430847
98478927
98478927
98478927
98567127
98654244
98738436
98811995
98816088
98880638
98910368
98910368
99007292
99007292
99057689
99067685
99087776
99181932
99207504
99207504
99235236
99235236
99287459
99376027
99421695
99490280
99511438
99536733
99570314
99570314
99598686
99632604
997...

result:

ok 2334 numbers

Test #22:

score: 2
Accepted
time: 1478ms
memory: 106060kb

input:

9
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 9...

output:

4983791224
4983840545
4983850512
4983851410
4983923005
4983977112
4984052170
4984063836
4984130680
4984140629
4984224361
4984323238
4984386454
4984430318
4984523551
4984621371
4984693390
4984708978
4984753944
4984779478
4984804419
4984892565
4984935901
4984939240
4985000757
4985001532
4985044637
498...

result:

ok 100001 numbers

Test #23:

score: 2
Accepted
time: 1497ms
memory: 109296kb

input:

9
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 9...

output:

5001930424
5002006599
5002017806
5002086058
5002108731
5002173748
5002237965
5002295437
5002362344
5002440802
5002450076
5002540998
5002576245
5002626568
5002717208
5002730667
5002827176
5002873718
5002933111
5002977389
5003025745
5003061710
5003142964
5003178260
5003246159
5003325766
5003376644
500...

result:

ok 100001 numbers

Test #24:

score: 2
Accepted
time: 1485ms
memory: 110136kb

input:

9
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 9...

output:

4992694782
4992697594
4992768009
4992804380
4992840561
4992874444
4992885619
4992955737
4992995322
4993084112
4993118702
4993202606
4993267662
4993314974
4993326745
4993422669
4993517838
4993529103
4993611232
4993633389
4993713983
4993739162
4993799728
4993799728
4993873588
4993890012
4993958720
499...

result:

ok 100001 numbers

Test #25:

score: 2
Accepted
time: 1810ms
memory: 99408kb

input:

10
100000 100000 100000
1 1 2 3 4 5 7 8 9 6 10 12 11 13 14 15 16 18 17 20 19 21 23 24 22 26 27 25 29 28 30 31 32 34 33 36 35 38 39 40 41 37 43 44 45 46 47 42 49 48 50 51 52 53 55 54 56 58 57 60 59 62 63 61 64 66 67 65 68 70 69 71 73 74 75 72 77 78 79 80 76 81 82 83 84 85 87 86 88 89 91 90 92 94 93 9...

output:

4256469136
4256479367
4256537016
4256586070
4256586070
4256606041
4256661130
4256703528
4256703528
4256706219
4256706219
4256707808
4256708744
4256765916
4256774063
4256789242
4256881443
4256904525
4256904525
4256913970
4256981179
4257075589
4257075589
4257131373
4257131373
4257162300
4257202889
425...

result:

ok 100001 numbers

Test #26:

score: 2
Accepted
time: 1770ms
memory: 102404kb

input:

10
100000 100000 100000
1 2 1 4 5 3 6 7 8 9 10 12 13 11 14 16 17 15 18 20 21 19 22 24 25 26 23 28 27 30 31 29 33 34 35 32 37 38 39 40 41 36 42 44 45 43 46 47 48 49 51 52 50 54 55 56 57 53 59 60 58 61 62 63 64 66 65 68 69 70 67 72 71 74 73 76 75 78 79 77 80 81 82 83 84 85 86 87 88 89 90 91 92 94 95 9...

output:

4276569611
4276569611
4276582468
4276632349
4276668691
4276681073
4276780133
4276780133
4276780133
4276789961
4276880969
4276939509
4276939509
4276939509
4276978803
4277060812
4277078795
4277115114
4277128646
4277130724
4277212137
4277302241
4277367149
4277424908
4277477489
4277477489
4277477489
427...

result:

ok 100001 numbers

Test #27:

score: 2
Accepted
time: 1835ms
memory: 100008kb

input:

10
100000 100000 100000
1 2 3 4 5 6 7 1 8 10 11 12 9 13 14 16 15 17 19 20 18 22 23 24 25 26 21 27 29 28 30 32 31 34 33 36 35 37 39 38 41 40 42 44 43 45 46 47 49 48 51 52 53 54 50 55 56 58 59 57 61 60 62 64 63 65 66 68 69 67 70 72 73 71 74 76 77 75 79 78 81 82 83 84 85 80 87 88 86 89 90 92 93 94 91 9...

output:

4267106136
4267111654
4267111654
4267111654
4267133068
4267137860
4267137860
4267137860
4267212849
4267212849
4267212849
4267212849
4267212849
4267284038
4267298096
4267394121
4267489771
4267506558
4267506558
4267506558
4267536639
4267589669
4267589669
4267616634
4267709064
4267719435
4267721310
426...

result:

ok 100001 numbers

Test #28:

score: 2
Accepted
time: 1786ms
memory: 99576kb

input:

10
100000 100000 100000
1 1 3 4 2 6 5 7 8 9 11 12 10 14 15 13 17 16 18 20 19 22 21 23 25 24 26 28 29 30 27 32 31 33 34 35 37 36 38 39 41 40 43 42 45 44 46 47 49 50 48 51 53 52 54 56 57 55 58 59 61 60 63 62 64 65 67 66 69 68 71 72 73 70 75 74 76 77 79 80 81 82 83 78 84 86 87 88 89 90 91 92 93 94 85 9...

output:

4272572529
4272605070
4272627196
4272668757
4272668757
4272765959
4272860320
4272907505
4272915280
4272948439
4272998675
4273075275
4273121096
4273137437
4273168084
4273218290
4273218290
4273257296
4273319451
4273386977
4273404052
4273404052
4273439925
4273468865
4273568376
4273663940
4273699430
427...

result:

ok 100001 numbers

Test #29:

score: 2
Accepted
time: 19ms
memory: 62020kb

input:

11
2333 2333 2333
1 1 2 3 4 5 7 6 8 10 9 12 13 14 15 16 17 11 19 20 18 22 21 24 23 25 26 28 27 29 31 32 30 33 35 36 34 38 37 39 40 41 43 42 45 46 44 47 49 50 51 52 53 54 48 55 56 58 59 57 60 61 63 64 65 66 62 68 67 69 70 72 71 74 75 76 73 77 79 80 81 78 83 82 85 86 87 84 88 90 91 92 93 94 95 96 97 9...

output:

98346715
98320738
98374109
98374109
98356862
98380497
98400545
98396852
98402318
98441468
98463438
98423019
98388518
98388518
98388518
98460607
98460607
98428423
98428423
98424987
98424987
98409507
98409507
98409507
98409507
98428586
98520686
98520686
98432315
98449552
98421842
98368486
98465997
983...

result:

ok 2334 numbers

Test #30:

score: 2
Accepted
time: 19ms
memory: 62048kb

input:

11
2333 2333 2333
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

99522112
99566564
99502944
99481645
99446700
99438739
99520155
99474582
99474582
99384439
99384439
99430696
99365433
99365433
99373929
99373929
99384771
99304914
99357340
99271857
99271857
99226504
99237934
99237934
99151132
99159556
99197865
99201840
99153129
99126696
99126696
99039774
99039774
990...

result:

ok 2334 numbers

Test #31:

score: 2
Accepted
time: 19ms
memory: 61824kb

input:

11
2333 2333 2333
1 1 3 4 2 5 6 7 9 10 11 8 13 12 14 15 16 17 19 20 18 22 23 24 25 21 27 28 29 30 26 32 33 34 35 31 37 38 36 39 40 42 41 44 43 45 47 48 46 49 50 52 53 54 55 51 57 58 56 59 61 60 62 64 65 63 67 66 68 70 71 69 72 74 75 76 77 73 79 78 80 82 81 84 83 85 86 87 89 90 88 91 93 94 92 95 97 9...

output:

98318975
98405504
98379386
98404489
98318159
98289544
98332067
98414460
98410844
98377307
98470189
98452976
98452976
98529202
98520785
98541735
98569251
98570871
98570871
98571961
98567552
98648351
98624658
98624658
98666011
98671101
98679273
98679273
98679273
98628401
98667033
98667033
98706817
986...

result:

ok 2334 numbers

Test #32:

score: 2
Accepted
time: 912ms
memory: 98692kb

input:

12
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

output:

82625
82625
82624
82624
82623
82624
82624
82625
82624
82625
82625
82626
82627
82628
82628
82629
82628
82628
82627
82627
82628
82628
82629
82628
82629
82630
82629
82630
82630
82629
82630
82629
82628
82629
82628
82628
82629
82630
82630
82630
82630
82629
82628
82628
82627
82627
82628
82628
82628
82629
...

result:

ok 100001 numbers

Test #33:

score: 2
Accepted
time: 660ms
memory: 102136kb

input:

12
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

output:

82796
82796
82797
82798
82798
82799
82800
82801
82802
82803
82804
82805
82806
82807
82807
82808
82808
82808
82808
82809
82810
82810
82811
82812
82812
82812
82812
82813
82813
82814
82815
82816
82817
82817
82818
82818
82819
82820
82821
82822
82823
82824
82824
82825
82826
82826
82826
82827
82828
82829
...

result:

ok 100001 numbers

Test #34:

score: 2
Accepted
time: 905ms
memory: 101272kb

input:

12
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

output:

82783
82782
82783
82784
82783
82782
82782
82782
82781
82781
82781
82782
82782
82782
82783
82782
82781
82782
82783
82782
82781
82781
82782
82782
82781
82781
82782
82783
82782
82782
82783
82782
82783
82783
82782
82782
82783
82783
82783
82783
82782
82782
82781
82780
82779
82779
82779
82778
82777
82776
...

result:

ok 100001 numbers

Test #35:

score: 2
Accepted
time: 1115ms
memory: 103204kb

input:

13
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

output:

4980366937
4980323023
4980291984
4980308351
4980310052
4980338501
4980260106
4980233673
4980271036
4980215946
4980247506
4980224143
4980140771
4980091199
4980050081
4980054096
4980099681
4980165146
4980122981
4980114331
4980098027
4980123658
4980095314
4980190496
4980203081
4980130411
4980083954
498...

result:

ok 100001 numbers

Test #36:

score: 2
Accepted
time: 1245ms
memory: 105368kb

input:

13
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

output:

4994181299
4994199567
4994296916
4994341409
4994258807
4994334972
4994354627
4994320484
4994307621
4994303947
4994243441
4994310817
4994292675
4994211943
4994310495
4994242753
4994170086
4994151211
4994124020
4994120808
4994186633
4994106520
4994019241
4994052169
4994081265
4994132791
4994168081
499...

result:

ok 100001 numbers

Test #37:

score: 2
Accepted
time: 1150ms
memory: 103324kb

input:

13
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

output:

5000749094
5000794377
5000892758
5000904958
5000928698
5000991728
5000969920
5000960366
5001023591
5001019706
5001013598
5001110465
5001185815
5001132402
5001158558
5001257410
5001271583
5001308714
5001251012
5001293735
5001372991
5001367360
5001372380
5001460572
5001541954
5001518591
5001489461
500...

result:

ok 100001 numbers

Test #38:

score: 2
Accepted
time: 1051ms
memory: 103380kb

input:

13
100000 100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

output:

5007627660
5007559765
5007591097
5007526656
5007455841
5007486709
5007501596
5007428399
5007359746
5007357945
5007373460
5007355863
5007445898
5007507062
5007560004
5007633180
5007541231
5007470920
5007494570
5007408631
5007430588
5007475703
5007436875
5007345282
5007391728
5007449468
5007384329
500...

result:

ok 100001 numbers

Test #39:

score: 2
Accepted
time: 825ms
memory: 95332kb

input:

14
66666 66666 66666
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...

output:

2936083439
2936143313
2936179079
2936257511
2936273083
2936359492
2936387580
2936430141
2936500354
2936500354
2936534787
2936534787
2936534787
2936631512
2936682065
2936761932
2936763538
2936763538
2936783481
2936788766
2936788766
2936857137
2936874629
2936918813
2936989311
2937064125
2937129956
293...

result:

ok 66667 numbers

Test #40:

score: 2
Accepted
time: 900ms
memory: 89728kb

input:

14
66666 66666 66666
1 2 1 4 3 5 7 8 9 10 6 11 12 14 13 15 17 18 19 16 21 20 22 23 25 26 27 24 28 30 31 29 33 32 34 36 37 35 38 39 41 42 43 40 45 44 47 46 49 50 51 48 53 54 55 52 57 56 59 60 58 62 61 63 64 65 66 67 68 69 70 72 71 74 75 76 77 73 79 80 81 78 83 82 85 84 86 87 88 90 89 92 93 91 95 96 9...

output:

2845059678
2845111971
2845124286
2845075440
2844993717
2844917477
2844894352
2844879104
2844822273
2844853428
2844847886
2844835182
2844742603
2844759241
2844829657
2844875374
2844864712
2844911140
2844989312
2844989312
2844966825
2844966825
2844986024
2844986024
2844963247
2844889996
2844819155
284...

result:

ok 66667 numbers

Test #41:

score: 2
Accepted
time: 900ms
memory: 89172kb

input:

14
66666 66666 66666
1 1 2 4 5 3 6 8 7 10 9 11 13 14 12 15 17 16 18 19 21 22 23 20 24 25 27 26 28 30 31 32 29 33 35 34 36 38 37 40 41 42 39 43 45 44 46 47 49 50 51 52 48 53 55 56 54 58 59 60 57 62 61 63 64 66 67 65 68 70 71 72 73 74 69 75 76 77 79 78 80 81 83 84 82 86 85 88 89 87 91 90 92 93 95 96 9...

output:

2855673525
2855697425
2855697425
2855787823
2855751122
2855751234
2855681434
2855692490
2855789367
2855719295
2855686577
2855691605
2855601210
2855639521
2855729836
2855790539
2855855044
2855881661
2855938223
2855954372
2855958133
2855866229
2855783621
2855737921
2855700675
2855628327
2855581804
285...

result:

ok 66667 numbers

Test #42:

score: 2
Accepted
time: 646ms
memory: 91204kb

input:

14
66666 66666 66666
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...

output:

2944133418
2944164060
2944164060
2944215039
2944129501
2944125775
2944113913
2944191819
2944277785
2944277785
2944253573
2944338702
2944331613
2944318397
2944285856
2944309537
2944318471
2944271299
2944238476
2944268295
2944289713
2944196078
2944196078
2944119675
2944165920
2944264501
2944246469
294...

result:

ok 66667 numbers

Test #43:

score: 2
Accepted
time: 842ms
memory: 94132kb

input:

14
66666 66666 66666
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...

output:

2936334256
2936343270
2936379950
2936392856
2936488574
2936573827
2936594329
2936615492
2936711648
2936719714
2936719714
2936721553
2936820143
2936821253
2936853738
2936883303
2936958428
2937055781
2937073818
2937100600
2937126340
2937178502
2937268348
2937350069
2937350069
2937369534
2937374000
293...

result:

ok 66667 numbers

Test #44:

score: 2
Accepted
time: 634ms
memory: 91356kb

input:

14
66666 66666 66666
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...

output:

2934715875
2934760198
2934764898
2934834174
2934902091
2934948374
2935012022
2935029392
2934984052
2934909487
2934815542
2934846139
2934868671
2934923969
2934985655
2935006553
2935006553
2935006553
2935006553
2934932004
2934884866
2934895565
2934895565
2934845242
2934869041
2934919247
2934942033
293...

result:

ok 66667 numbers

Test #45:

score: 2
Accepted
time: 1513ms
memory: 96152kb

input:

15
100000 100000 100000
1 2 3 4 1 5 6 8 7 9 11 12 10 14 13 16 15 18 17 19 21 20 23 22 25 24 27 28 29 26 31 32 33 30 35 34 37 36 39 38 41 40 42 44 43 45 46 47 48 50 49 51 53 52 54 55 56 57 59 60 61 58 62 63 65 66 64 68 69 67 71 72 70 74 75 76 77 73 79 80 78 82 81 83 85 84 87 86 89 90 88 92 93 94 95 9...

output:

4261432590
4261347658
4261403578
4261415625
4261452389
4261452389
4261415364
4261415364
4261436857
4261436857
4261467046
4261503436
4261503436
4261550432
4261550432
4261550432
4261550432
4261626801
4261626801
4261643583
4261637931
4261695005
4261633280
4261627598
4261591140
4261688099
4261688099
426...

result:

ok 100001 numbers

Test #46:

score: 2
Accepted
time: 1443ms
memory: 96632kb

input:

15
100000 100000 100000
1 2 3 1 4 6 7 5 8 10 11 12 13 14 9 16 17 18 19 15 21 20 22 24 25 26 23 27 29 28 31 30 32 34 35 33 37 38 39 36 41 42 40 44 45 43 46 48 49 50 51 52 53 47 55 56 54 57 59 58 60 61 62 64 65 66 67 63 69 68 71 72 73 70 75 76 74 78 79 80 81 82 77 84 83 85 86 87 88 89 90 91 93 94 92 9...

output:

4255471314
4255482697
4255403142
4255397455
4255399228
4255392113
4255392113
4255318073
4255318073
4255318073
4255383872
4255335872
4255315988
4255341759
4255341759
4255342925
4255342925
4255299025
4255371988
4255391340
4255333807
4255333807
4255390585
4255411965
4255440591
4255501287
4255524474
425...

result:

ok 100001 numbers

Test #47:

score: 2
Accepted
time: 1813ms
memory: 99048kb

input:

15
100000 100000 100000
1 2 1 3 4 5 7 6 8 9 11 10 12 14 15 13 17 16 19 20 18 21 23 24 22 25 26 27 29 28 30 32 31 34 33 36 35 37 39 40 41 42 38 43 44 46 47 48 45 49 50 52 53 54 55 51 56 57 59 60 58 62 63 61 65 66 67 68 69 70 64 72 71 74 75 73 76 78 79 80 81 77 82 83 85 86 87 84 89 90 88 91 92 94 93 9...

output:

4263894872
4263906678
4263973098
4264011379
4264053071
4264077729
4264081386
4264100912
4264116944
4264141602
4264182615
4264237836
4264330986
4264330986
4264412594
4264446877
4264446877
4264453161
4264545883
4264605278
4264640490
4264713244
4264770455
4264771115
4264771115
4264870721
4264881612
426...

result:

ok 100001 numbers

Test #48:

score: 2
Accepted
time: 1868ms
memory: 102768kb

input:

15
100000 100000 100000
1 1 3 2 5 6 4 7 9 8 10 12 13 14 15 16 17 11 18 20 19 22 21 24 23 26 27 25 29 28 31 32 30 34 33 35 36 38 37 39 40 42 43 41 44 46 45 48 47 49 50 51 52 53 55 54 57 56 59 60 58 61 63 64 62 66 65 68 67 70 71 69 73 74 72 75 76 77 79 78 81 82 83 80 85 86 84 87 89 90 91 92 88 94 95 9...

output:

4277723507
4277770423
4277797849
4277842276
4277930268
4277960665
4277982924
4277986264
4278025622
4278107881
4278107881
4278166292
4278173243
4278207866
4278274409
4278291282
4278327438
4278417992
4278445785
4278496314
4278578816
4278603899
4278614942
4278625305
4278625305
4278667667
4278669456
427...

result:

ok 100001 numbers

Test #49:

score: 2
Accepted
time: 1463ms
memory: 94736kb

input:

15
100000 100000 100000
1 2 3 4 5 1 7 6 8 9 11 12 13 10 15 16 14 17 19 18 21 22 20 24 23 26 25 28 27 30 29 32 31 34 33 35 37 36 38 40 39 41 42 43 45 46 44 48 47 49 51 50 53 54 55 56 52 58 59 57 60 62 63 61 64 66 67 65 68 70 69 72 73 71 75 76 77 78 79 74 81 80 83 82 84 86 87 85 89 88 91 92 90 94 93 9...

output:

4250187762
4250200917
4250294941
4250381324
4250381324
4250297272
4250216812
4250216812
4250138636
4250175622
4250111196
4250111196
4250111196
4250120743
4250197253
4250197253
4250168978
4250235194
4250142689
4250184133
4250175665
4250170268
4250200610
4250214188
4250150259
4250150259
4250206624
425...

result:

ok 100001 numbers

Test #50:

score: 2
Accepted
time: 1422ms
memory: 99920kb

input:

15
100000 100000 100000
1 1 2 4 5 3 6 7 9 8 11 12 10 13 15 16 17 14 18 19 21 22 23 24 25 20 26 27 29 30 31 32 33 28 34 35 37 38 36 40 39 42 41 43 45 46 44 47 49 50 48 52 53 51 55 54 57 56 58 59 61 62 63 64 60 66 65 68 69 70 71 72 67 74 75 73 77 76 79 78 80 81 83 84 85 82 87 86 88 89 91 90 93 94 95 9...

output:

4270838194
4270838194
4270838194
4270838194
4270842480
4270869856
4270897009
4270897009
4270825273
4270825273
4270789063
4270767304
4270767304
4270852265
4270842540
4270916571
4270916874
4270851431
4270851431
4270872615
4270938087
4270954300
4270922365
4270922365
4271005129
4271034438
4271043576
427...

result:

ok 100001 numbers

Extra Test:

score: 0
Extra Test Passed