Submission #1778795


Source Code Expand

#include<bits/stdc++.h>  
#define N 100009  
using namespace std;  
typedef long long LL;  
const LL INF = 0x3f3f3f3f;  
   
LL h[N];  
LL n, a, b;  
   
bool judge(LL mid)  
{  
    LL ans = mid;  
    for(int i = 1; i <= n; i++)  
    {  
        LL tm = h[i] - b*mid;  
        if(tm > 0)  
        {  
            LL cnt = tm / (a - b) + (tm % (a - b) == 0 ? 0 : 1);  
            ans -= cnt;  
            if(ans < 0) return false;  
        }  
    }  
    return true;  
}  
   
int main()  
{  
    scanf("%lld%lld%lld", &n, &a, &b);  
    for(int i = 1; i <= n; i++) scanf("%lld", &h[i]);  
    LL l = 0, r = INF;  
    LL ans = INF;  
    while(l <= r)  
    {  
        LL mid = (l + r)>>1;  
        if(judge(mid)) ans = mid, r = mid - 1;  
        else l = mid + 1;  
    }  
    printf("%lld\n", ans);  
  

Submission Info

Submission Time
Task D - Widespread
User vjudge2
Language Bash (GNU bash v4.3.11)
Score 0
Code Size 820 Byte
Status RE
Exec Time 4 ms
Memory 584 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 4 ms 580 KB
a02 RE 4 ms 584 KB
a03 RE 4 ms 576 KB
b04 RE 4 ms 580 KB
b05 RE 4 ms 580 KB
b06 RE 4 ms 576 KB
b07 RE 4 ms 576 KB
b08 RE 4 ms 584 KB
b09 RE 4 ms 572 KB
b10 RE 4 ms 584 KB
b11 RE 4 ms 580 KB
b12 RE 4 ms 580 KB
b13 RE 4 ms 584 KB