• 2017 Benelux Algorithm Programming Contest (BAPC 17)


    地址

    Rank Solved A B C D E F G H I J K L M
    41/255 9/13 O . O O O O Ø . O Ø O O O

    O: 当场通过

    Ø: 赛后通过

    .: 尚未通过

    A Amsterdam Distance

    solved by chelly


    chelly's solution

    B Bearly Made It

    unsolved


    C Collatz Conjecture

    solved by chelly


    chelly's solution

    D Detour

    solved by chelly


    chelly's solution

    E Easter Eggs

    solved by chelly


    chelly's solution

    F Falling Apart

    solved by chelly


    chelly's solution

    G Going Dutch

    upsolved by chelly


    chelly's solution

    如果我们挑出一个集合,大小为n,它们的和为0,那我们最多只需要n-1次交换即可使得每个人达到平衡
    于是问题就变成了,将原来的n个人分成尽可能多的集合,使得每个集合里的和都是0
    考虑状压DP,最简单的想法就是枚举子集,但这样(3^n)无法接受
    其实可以这样:(dp[s])表示s这个集合,最多能分成多少个和为0的子集,然后转移的时候转移到(dp[s|(1<<i)]),如果发现s的和与(1<<i)的和加起来是零,说明可以额外凑出一组为0的子集,转移的收益就是1,否则就是0

    H Hoarse Horses

    unsolved


    I Irrational Division

    solved by chelly


    chelly's solution

    J Jumping Choreography

    upsolved by chelly


    chelly's solution

    (f_i)表示一个青蛙跳到离它距离为i的位置至少需要多少步
    我们先考虑如何求这个(f_i),通过找规律可以发现,如果青蛙跳x步,那么它可以跳到([-frac{x(x+1)}{2},frac{x(x+1)}{2}])这段区间内与(frac{x(x+1)}{2})奇偶性相同的位置
    那么对于1e6,我们就去给区间打min标记,最后统计一下就行了,于是就求出了(f_1~f_{1000000})
    然后这个f大概只有1400段,于是对于每个青蛙,我们都知道离它距离1400段之内的答案,所以一次增加/删除青蛙是1400*log复杂度的,对于一次询问就相当于是单点询问
    所以直接树状数组就行了

    K King of the Waves

    solved by chelly


    chelly's solution

    L Lemonade Trade

    solved by ch&chelly


    chelly's solution

    M Manhattan Mornings

    solved by chelly


    chelly's solution

    Dirt Replay

  • 相关阅读:
    mysql_数据查询_嵌套查询
    mysql_数据查询_连接查询
    大白_uva10795_新汉诺塔
    codeforces_731C_[dfs][并查集]
    Ajax+asp.net实现用户登陆 转自http://www.shangxueba.com/jingyan/2933319.html
    entity framework 中一些常用的函数 转自http://www.cnblogs.com/williamzhu/
    转自新浪博客的网页运作原理
    一些ASP.NET的小知识点
    。。
    .NET
  • 原文地址:https://www.cnblogs.com/Amadeus/p/9957123.html
Copyright © 2020-2023  润新知