Submission #1778785
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],v[N]; ll n; ll a,b; bool Check(ll x) { ll num,ans=x,sum; for (int i=0;i<n;i++) v[i]=w[i]; for (int i=0;i<n;i++) { v[i]-=x*b; if (v[i]>0) { if (v[i]%(a-b)==0) num=v[i]/(a-b); else num=(v[i]/(a-b)+1); ans-=num; } } if (ans<0) return false; else return true; } int main() { scanf("%d%d%d",&n,&a,&b); for (int i=0;i<n;i++) scanf("%d",&w[i]); sort(w,w+n); ll lb=0,ub=w[n-1]; while(ub-lb>1){ ll mid=(lb+ub)/2; if(Check(mid)) ub=mid; else lb=mid; } cout << ub << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Widespread |
User | vjudge3 |
Language | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 1002 Byte |
Status | RE |
Exec Time | 8 ms |
Memory | 640 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 | 636 KB |
a02 | RE | 4 ms | 580 KB |
a03 | RE | 4 ms | 592 KB |
b04 | RE | 4 ms | 584 KB |
b05 | RE | 4 ms | 640 KB |
b06 | RE | 4 ms | 580 KB |
b07 | RE | 4 ms | 604 KB |
b08 | RE | 4 ms | 584 KB |
b09 | RE | 4 ms | 584 KB |
b10 | RE | 4 ms | 640 KB |
b11 | RE | 4 ms | 596 KB |
b12 | RE | 4 ms | 588 KB |
b13 | RE | 4 ms | 584 KB |