1 solutions
Information
- ID
- 1620
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 11
- Accepted
- 0
- Uploaded By
分类讨论题,手玩可以发现答案不会超过 2。
暴力枚举所有可能的情况,时间复杂度为 O(n!)。
当序列 A 中 0 的个数不超过 ⌊2n+1⌋ 时,可以发现答案一定是 0,因为可以 0,x,0,y,0,... 这样交替着放,保证没有两个 0 是挨着的。
答案为 0 就是上面这种情况。
答案为 1 有以下两种情况:
否则答案一定为 2。
By signing up a Hydro universal account, you can submit code and join discussions in all online judging services provided by us.