Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define rep(i,x,y) for(int i=x;i<y;i++)
- #define repr(i,x,y) for(int i=x;i>=y;i--)
- #define int long long
- #define pb push_back
- #define ff first
- #define ss second
- #define sz(x) ((int)x.size())
- #define all(x) begin(x), end(x)
- #define memo(x,y) memset((x),(y),sizeof((x)))
- #define line cout<<"[At "<<__LINE__<<"]"<<endl;
- using pii = pair<int,int>;
- using vi = vector<int>;
- using vii = vector<pair<int,int>>;
- constexpr int mod = 1e9 + 7 , N = 2e5 + 5;
- constexpr long long inf = 1e18;
- constexpr long double eps = 1e-6;
- void Onigiri()
- {
- int n,x,y;
- cin>>n>>x>>y;
- int c[n];
- rep(i,0,n){
- cin>>c[i];
- }
- int l=0,r=1e9,ans=-1;
- while(l<=r){
- int m=(l+r)/2;
- int cnt=m;
- for(int i=0;i<n;i++){
- if(c[i]>y*m){
- cnt-=(c[i]-y*m+x-y-1)/(x-y);
- }
- }
- if(cnt>=0){
- ans=m;
- r=m-1;
- }else l=m+1;
- }
- cout<<ans;
- }
- signed main()
- {
- ios_base::sync_with_stdio(false);cin.tie(NULL);
- //cout.precision(10);cout<<fixed;
- #ifdef Zoro
- freopen("/home/pritish/Competitive/in", "r", stdin);
- freopen("/home/pritish/Competitive/out", "w", stdout);
- #endif
- int t=1;
- cin>>t;
- while(t--)
- {Onigiri();cout<<"\n";}
- cerr<<"\n"<<(float)clock()/CLOCKS_PER_SEC*1000<<" ms"<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement