Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma comment(linker, "/STACK:64777216")
- #define _CRT_SECURE_NO_WARNINGS
- #include<iostream>
- #include<stdio.h>
- #include<algorithm>
- #include<vector>
- #include<math.h>
- #include<string>
- #include<sstream>
- #include<set>
- #include<map>
- #include<stack>
- #include<queue>
- #include<deque>
- #include<memory.h>
- #include<ctype.h>
- #include<stdio.h>
- #define pb push_back
- #define sz(a) (int)a.size()
- #define bs binary_search
- #define np next_permutation
- #define mp make_pair
- #define all(a) a.begin(),a.end()
- typedef long long ll;
- using namespace std;
- const double pi = 3.141592653589793238, eps = 1e-9;
- const ll INF = 9999999999;
- int n, i, a[5000005], k, col = 0, x, j;
- vector<int> ans;
- bool used[5000005];
- void prepare(string s) {
- #ifdef _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt","w",stdout);
- #else
- if (sz(s) != 0) {
- freopen((s + ".in").c_str(), "r", stdin);
- freopen((s + ".out").c_str(), "w", stdout);
- }
- #endif
- }
- int bin_search (int l, int r){
- int mid = (l + r) / 2;
- if (a[mid] <= x && !used[mid])
- return mid;
- else
- return bin_search (mid, r);
- }
- int main()
- {
- prepare("");
- cin>> n;
- memset(used, false, sizeof used);
- for (i=0;i<n;i++)
- cin>> a[i];
- sort(a, a + n);
- reverse(a, a + n);
- int ind = -1;
- int ps;
- if (n % 2 == 0)
- ps = n / 2;
- else
- ps = n / 2 + 1;
- for (i=ps;i<n;i++)
- if (a[i] * 2 <= a[0])
- {
- ind = i;
- col++;
- break;
- }
- int pos = 0;
- if (ind == -1)
- cout<< n;
- else
- {
- for (i=ind+1;i<n;i++)
- for (j=pos+1;j<ind;j++)
- if (a[i] * 2 <= a[j])
- {
- col++;
- ind = i;
- pos = j;
- break;
- }
- cout<< n - col;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement