AhmedAshraff

Untitled

Aug 1st, 2025
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. typedef long long ll;
  5. #define sz(s) (int)(s).size()
  6. #define all(s) s.begin(),s.end()
  7.  
  8. void Speed() {
  9.     ios_base::sync_with_stdio(false);
  10.     cin.tie(NULL);
  11. }
  12.  
  13. void solve() {
  14.     int n,l,k;
  15.     cin>>n>>l>>k;
  16.     vector<pair<int,int>>v(n);
  17.     for(auto &[x,y]:v)cin>>x>>y;
  18.     int ans=1e9;
  19.     auto get=[&](ll r)->int{
  20.         int c=0;
  21.         for(auto [x,y]:v){
  22.             ll d=1ll*x*x+1ll*y*y;
  23.             while(r*r<d){
  24.                 r*=2;
  25.                 c++;
  26.             }
  27.         }
  28.         return c;
  29.     };
  30.     for(int i=0;i<40;i++){
  31.         ans=min(ans,i+get(0ll+l+1ll*i*k));
  32.     }
  33.     cout<<ans<<'\n';
  34. }
  35.  
  36. int main() {
  37.     Speed();
  38.     int tc = 1;
  39.     cin >> tc;
  40.     while (tc--) {
  41.         solve();
  42.     }
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment