zoukankan      html  css  js  c++  java
  • HDU 5360 Hiking(优先队列)

    Hiking

    Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
    Total Submission(s): 492    Accepted Submission(s): 263
    Special Judge


    Problem Description
    There are n soda conveniently labeled by 1,2,,n. beta, their best friends, wants to invite some soda to go hiking. The i-th soda will go hiking if the total number of soda that go hiking except him is no less than li and no larger than ri. beta will follow the rules below to invite soda one by one:
    1. he selects a soda not invited before;
    2. he tells soda the number of soda who agree to go hiking by now;
    3. soda will agree or disagree according to the number he hears.

    Note: beta will always tell the truth and soda will agree if and only if the number he hears is no less than li and no larger than ri, otherwise he will disagree. Once soda agrees to go hiking he will not regret even if the final total number fails to meet some soda's will.

    Help beta design an invitation order that the number of soda who agree to go hiking is maximum.
     

    Input
    There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:

    The first contains an integer n (1n105), the number of soda. The second line constains n integers  查看全文
  • 相关阅读:
    拜师鸟哥之linux学习体会(1)——计算器概论
    LeetCode刷题1
    jupyter notebook直接打开.md格式的文件
    [图论]最短网络:prim
    [图论]最短网络:kruskal
    [图论]最优布线问题:kruskal
    A+B Problem
    [图论]最优布线问题:prim
    [图论]求连通分量
    [图论]连通图:深搜(邻接矩阵)
  • 原文地址:https://www.cnblogs.com/cynchanpin/p/6817500.html
Copyright © 2011-2022 走看看