• P


    P - Sereja and Contest
    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u
    Submit Status
    Appoint description: 

    Description

    During the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made unrated for some participants.

    Let's assume that n people took part in the contest. Let's assume that the participant who got the first place has rating a1, the second place participant has rating a2..., the n-th place participant has rating an. Then changing the rating on the Codesecrof site is calculated by the formula .

    After the round was over, the Codesecrof management published the participants' results table. They decided that if for a participant di < k, then the round can be considered unrated for him. But imagine the management's surprise when they found out that the participants' rating table is dynamic. In other words, when some participant is removed from the rating, he is removed from the results' table and the rating is recalculated according to the new table. And of course, all applications for exclusion from the rating are considered in view of the current table.

    We know that among all the applications for exclusion from the rating the first application to consider is from the participant with the best rank (the rank with the minimum number), for who di < k. We also know that the applications for exclusion from rating were submitted by all participants.

    Now Sereja wonders, what is the number of participants to be excluded from the contest rating, and the numbers of the participants in the original table in the order of their exclusion from the rating. Pay attention to the analysis of the first test case for a better understanding of the statement.

    Input

    The first line contains two integers nk(1 ≤ n ≤ 2·105,  - 109 ≤ k ≤ 0). The second line contains n space-separated integersa1, a2, ..., an(1 ≤ ai ≤ 109) — ratings of the participants in the initial table.

    Output

    Print the numbers of participants in the order in which they were removed from the table. Print the initial numbers of the participants, that is, the numbers that the participants had in the initial table.

    Sample Input

    Input
    5 0
    5 3 4 1 2
    Output
    2
    3
    4
    Input
    10 -10
    5 5 1 7 5 1 2 4 9 2
    Output
    2
    4
    5
    7
    8
    9

    FAQ | About Virtual Judge | Forum | Discuss | Open Source Project
    All Copyright Reserved ©2010-2012 HUST ACM/ICPC TEAM 
    Anything about the OJ, please ask in the forum, o
    int num[maxn];
    vector<int> ans;
    int main() 
    {
        //freopen("in.txt","r",stdin);
        int n,k;
        while(cin>>n>>k)
        {
            ans.clear();
            repf(i,1,n) scanf("%d",&num[i]);
            
            int sum = 0;
            int j = 2;
            int N = n;
            repf(i,2,N)
            {
                if(n != j &&((sum - k)/(double)(j - 1)/(n - j) < num[i]))
                {
                    ans.push_back(i);
                    n--;
                    continue;
                }
                if(n == j && sum < k)
                {
                    ans.push_back(i);
                    n--;
                    continue;
                }
                sum += num[i]*(j - 1);
                j++;
            }
            rep(i,0,ans.size())
                cout<<ans[i]<<endl;
        }
        return 0;
    }
  • 相关阅读:
    Flask把变量注册到模板中
    $.each与$(data).each区别
    【Python备忘】python判断文件和文件夹是否存在
    ISP图像质量自动化测试方法
    使用微软的(how-old.net)构建智能门店管理系统
    在virtualenv中安装libxml2和libxslt
    Python 装饰器学习以及实际使用场景实践
    tensorflow零起点快速入门(4) --入门常用API
    tensorflow零起点快速入门(3)
    树莓派和STM32通过USB和串口通信记录
  • 原文地址:https://www.cnblogs.com/DreamHighWithMe/p/3443914.html
Copyright © 2020-2023  润新知