码迷,mamicode.com
首页 > 其他好文 > 详细

Codeforces Round #407 (Div. 2)

时间:2017-05-24 12:41:29      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:最大权值   force   pre   other   code   class   div   and   span   

A 模拟

B 大力分类讨论

  1. |b1|?>?l — answer is 0.
  2. b1?=?0 — if 0 is present in array a than answer is 0, else inf.
  3. q?=?1 — if b1 is present in array a than answer is 0, else inf.
  4. q?=??-?1 — if both b1 and ?-?b1 are present in array a than answer is 0, otherwise inf.
  5. q?=?0 — if 0 isn‘t present in array a than answer is inf, else if b1 is present in a than answer is 0, else answer is 1.
  6. 直接暴力判

或者是取巧的方法,观察到如果可能出现循环,由于循环节<=2,答案只能是0,1,inf.

//其实也要讨论,只不过代码变短了许多

C 枚举结尾的位置,类dp一波 //f[i] = 以i为头的子串最大权值

Codeforces Round #407 (Div. 2)

标签:最大权值   force   pre   other   code   class   div   and   span   

原文地址:http://www.cnblogs.com/supy/p/6898089.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!