博客
关于我
[ARC100-F][DP]Colorful Sequences
阅读量:92 次
发布时间:2019-02-26

本文共 1292 字,大约阅读时间需要 4 分钟。

?????????????

????

??????? [1, K] ?????? n ???????????????? K ??????????? K ? 1 ? K ? K????? [1, K] ???????????????????????????

?????????

?? dp[i][j] ????? i ??????? j ????????????????????????????? j ??? 0 ? K ??????????????????????

??????

??????????????????1 ? K????????????????????????????????????????

????

  • ?? 1?

    • ??????? j??? 1 ??? j + 1?
    • ?????????????? K ??????? K ? K??????????????
  • ?? K?

    • ??????? j??? K ??? j + 1?
    • ?????????????? K ??????? K ? 1?
  • ??????????????????????????????????????????????????????????

    ??????

    ??????????? s ? s1?

    • s[i] ??? i ???? 1 ????
    • s1[i] ??? i ???? K ????

    ???????????????????????????????

    ?????????

    ????

    • dp[0][0] = 1???????????
    • ?? dp[i][j] ???? 0?

    ????

    ?????? i ??? j??????????? 1 ??? K?

  • ?? 1?

    • ?? s ???s[i] = s[i-1] + 1?
    • ????????????????????
  • ?? K?

    • ?? s1 ???s1[i] = s1[i-1] + 1?
    • ????????????????????
  • ????

    ????????????????????????????????????????? 1 ? K??????????????????? K ??????? K ? 1 ? K ? K?

    ?????????? s ? s1 ???????????????????

    ????

    ?????????????????????????????????????????????????????????????????????????????????????

    ??????

    • ? n < 2K ???????????? K ???????????????????
    • ? K = 0 ?????????????? K >= 1?
    • ? n = K ??????????? K ???????????????

    ????

    ???????????????????????????????????????????? O(nK)??????? n ? K ??

    ??????????????? g[n][K] ???????? n ??????????????

    转载地址:http://gemu.baihongyu.com/

    你可能感兴趣的文章
    python中exit和break区别_Python中exit()和sys.exit()之间的区别
    查看>>
    python中h5的用法
    查看>>
    python中http协议编程_HTTP编程
    查看>>
    python中import os_Python:相对导入与绝对导入(import)、os.path、__file__
    查看>>
    python中is和==操作符
    查看>>
    Python中range对象的使用以及打印九九乘法表
    查看>>
    Python中set.discard和set.remove方法之间的运行时差异?
    查看>>
    python中tkinter中value_输入字段中的python Tkinter get()值
    查看>>
    Python中wx.FlexGridSizer
    查看>>
    Python中xPath技术和BeautifulSoup的使用
    查看>>
    python中yield的用法详解——最简单,最清晰的解释
    查看>>
    python中‘set.intersection()‘的算法是什么?
    查看>>
    Python中一个图形中的多个绘图
    查看>>
    python中一个好的持久同步队列
    查看>>
    Python中不准确的对数
    查看>>
    python中什么是实例方法_在Python中创建实例方法对象的不同方法
    查看>>
    Python中使用cutecharts实现简单的手绘风格的图表
    查看>>
    python中使用dxfgrabber,解析dxf文件信息生成obj文件
    查看>>
    Python中使用ncmbot玩转网易云音乐
    查看>>
    Python中使用PIL快速实现二值图
    查看>>