fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define all(x) x.begin(), x.end()
  4. #define endl '\n'
  5. using namespace std;
  6. //*** Accepted Ya Diaa ***
  7. //A is my love 'accepted'
  8. //I hate you 'Run Time Error'
  9. int IHateRecursion(int s,int e) {
  10. if (s==e) {
  11. return 1;
  12. }
  13. if (s>e) {
  14. return 0;
  15. }
  16. return IHateRecursion(s+1,e)+IHateRecursion(s+2,e)+IHateRecursion(s+3,e);
  17. }
  18. //>=x&&<=y
  19. ll count(vector<int>v,int x,int y) {
  20. return (upper_bound(all(v),y)-lower_bound(all(v),x));
  21. }
  22. bool can(vector<int>&v,int n,int c,int mid) {
  23. ll s=1,last=v[0];
  24. for (int i=1;i<n;i++) {
  25. if (v[i]-last>=mid) {
  26. s+=1;
  27. last=v[i];
  28. if (s>=c) {
  29. return true;
  30. }
  31. }
  32. }
  33. return s>=c;
  34. }
  35.  
  36. void solve() {
  37. ios::sync_with_stdio(false);
  38. cin.tie(nullptr);
  39. freopen("input.txt","r",stdin);
  40. freopen("output.txt","w",stdout);
  41. int n;cin>>n;
  42. vector<int>v(n);
  43. for (int i=0;i<n;i++) {
  44. cin>>v[i];}
  45. sort(all(v));
  46. if (v[0]*2>=v[n-1]) {
  47. cout<<0<<endl;
  48. return;
  49. }
  50. int l=0,r=n-1;
  51. int c=0;
  52. while (l<=r) {
  53. if (v[l]*2>=v[r]) {
  54. break;
  55. }
  56. c++;
  57. r--;
  58. }
  59. cout<<n-r-1<<endl;
  60. }
  61. int main() {
  62.  
  63. solve();
  64.  
  65. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty