Submission #1778750
Source Code Expand
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<cmath> #include<algorithm> #include<stack> #include<queue> #include<set> #include<vector> #include<map> #define N 100100 #define abs(x) return x>0?x:(-x) #define sqr(x) return x*x typedef long long ll; using namespace std; // coding........ ll w[N]; int n; ll a,b; bool Check(ll x) { ll num=0; for (int i=0;i<n;i++) { ll ans=w[i]-x*b; if (ans>0) { num+=(ans/(a-b)); if (ans%(a-b)) num++; if (num>x||num<0) return false; } } return true; } int main() { scanf("%d%lld%lld",&n,&a,&b); ll maxn=0; for (int i=0;i<n;i++) { scanf("%lld",&w[i]); maxn=max(maxn,w[i]); } ll l=0,r=maxn; while (l<r) { ll mid=(l+r)/2; if (Check(mid)) r=mid; else l=mid+1; } printf("%lld\n",r); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Widespread |
User | vjudge1 |
Language | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 995 Byte |
Status | RE |
Exec Time | 8 ms |
Memory | 768 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||
Status |
|
|
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 | 8 ms | 768 KB |
a02 | RE | 4 ms | 584 KB |
a03 | RE | 4 ms | 580 KB |
b04 | RE | 4 ms | 592 KB |
b05 | RE | 4 ms | 640 KB |
b06 | RE | 4 ms | 640 KB |
b07 | RE | 4 ms | 640 KB |
b08 | RE | 4 ms | 580 KB |
b09 | RE | 4 ms | 604 KB |
b10 | RE | 4 ms | 600 KB |
b11 | RE | 4 ms | 592 KB |
b12 | RE | 4 ms | 584 KB |
b13 | RE | 4 ms | 584 KB |