蒟蒻求调(0分)

P1114 “非常男女”计划

$O(N^2)$必超时
by 违规用户名971024 @ 2024-10-04 11:48:25


用的暴力枚举
by kkksc_tbh @ 2024-10-04 11:48:37


用前缀和(男加女减),然后从后依次选一个,从前面找相同值(常识:(l,r)内前缀和=pre[r]-pre[l-1])让前缀和等于零,若等于零说明男女数量相等,又由于最后对最前,找到就说明长度最大
by aiwenti @ 2024-10-04 12:06:46


@[aiwenti](/user/1274809) 谢谢dolao
by kkksc_tbh @ 2024-10-04 13:42:41


|