Submission #1778035
Source Code Expand
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<cmath> #include<algorithm> #include<stack> #include<queue> #include<set> #include<map> #include<vector> #define N 100000 #define mem(a,b) memset(a,b,sizeof(a)) #define sqr(x) return x*x #define abs(x) return x>0?x:(-x) typedef long long ll; //coding........ using namespace std; int n, a, b, w[N+3]; bool Check(ll ans) { ll sum = 0; for(int i=0; i<n; ++i) { ll temp = (ll)w[i]-ans*b; if(temp>0) { sum += (int)ceil(temp*1.0/(a-b)); if(sum > ans || sum < 0) return false; } } return true; } int main() { while(~scanf("%d%d%d",&n,&a,&b)) { int Max = 0; for(int i=0; i<n; ++i) scanf("%d",&w[i]), Max = max(Max, w[i]); ll left=0, right=Max; while(left<right) { ll mid = (left+right)/2; if(Check(mid)) right=mid; else left=mid+1; } printf("%lld\n",right); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Widespread |
User | vjudge5 |
Language | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 1063 Byte |
Status | RE |
Exec Time | 4 ms |
Memory | 644 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 | 4 ms | 640 KB |
a02 | RE | 4 ms | 580 KB |
a03 | RE | 4 ms | 580 KB |
b04 | RE | 4 ms | 588 KB |
b05 | RE | 4 ms | 644 KB |
b06 | RE | 4 ms | 572 KB |
b07 | RE | 4 ms | 644 KB |
b08 | RE | 4 ms | 584 KB |
b09 | RE | 4 ms | 640 KB |
b10 | RE | 4 ms | 632 KB |
b11 | RE | 4 ms | 580 KB |
b12 | RE | 4 ms | 604 KB |
b13 | RE | 4 ms | 640 KB |