Submission #1777957
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 100100 #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......................... int w[N]; int n; int a,b; int maxn=0; using namespace std; int Check(ll ans) { int 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 0; } } return 1; } void solve() { ll left=0,right=maxn; while (left<right) { ll mid=(left+right)/2; if (Check(mid)) right=mid; else left=mid+1; } printf("%lld\n",right); } int main() { while(~scanf("%d%d%d",&n,&a,&b)) { maxn=0; for (int i=0;i<n;i++) { scanf("%d",&w[i]); maxn=max(maxn,w[i]); } solve(); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Widespread |
User | vjudge2 |
Language | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 1133 Byte |
Status | RE |
Exec Time | 5 ms |
Memory | 648 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 | 5 ms | 620 KB |
a02 | RE | 5 ms | 648 KB |
a03 | RE | 5 ms | 644 KB |
b04 | RE | 5 ms | 644 KB |
b05 | RE | 5 ms | 644 KB |
b06 | RE | 5 ms | 592 KB |
b07 | RE | 5 ms | 588 KB |
b08 | RE | 5 ms | 592 KB |
b09 | RE | 5 ms | 644 KB |
b10 | RE | 5 ms | 640 KB |
b11 | RE | 5 ms | 648 KB |
b12 | RE | 5 ms | 640 KB |
b13 | RE | 5 ms | 572 KB |