Submission #1778789


Source Code Expand

# include <bits/stdc++.h>
using namespace std;

typedef long long LL;
const int maxn = 1e5;
int n, a, b, m[maxn+3];

bool judge(LL x)
{
    LL sum = 0;
    for(int i=0; i<n; ++i)
    {
        LL t = (LL)m[i]-x*b;
        if(t>0)
        {
            sum += (int)ceil(t*1.0/(a-b));
            if(sum > x || sum < 0)
                return false;
        }
    }
    return true;
}
int main()
{
    while(~scanf("%d%d%d",&n,&a,&b))
    {
        int imax = 0;
        for(int i=0; i<n; ++i) scanf("%d",&m[i]), imax = max(imax, m[i]);
        LL l=0, r=imax;
        while(l<r)
        {
            LL mid = l+r>>1;
            if(judge(mid)) r=mid;
            else l=mid+1;
        }
        printf("%lld\n",r);
    }
    return 0;
}

Submission Info

Submission Time
Task D - Widespread
User vjudge3
Language Bash (GNU bash v4.3.11)
Score 0
Code Size 737 Byte
Status RE
Exec Time 5 ms
Memory 592 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
RE × 3
RE × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 RE 5 ms 524 KB
a02 RE 3 ms 592 KB
a03 RE 3 ms 584 KB
b04 RE 3 ms 584 KB
b05 RE 3 ms 576 KB
b06 RE 3 ms 580 KB
b07 RE 3 ms 584 KB
b08 RE 3 ms 580 KB
b09 RE 3 ms 580 KB
b10 RE 3 ms 584 KB
b11 RE 3 ms 580 KB
b12 RE 3 ms 592 KB
b13 RE 3 ms 576 KB