import sys
sys.setrecursionlimit(200000)
class UF:
def __init__(self, n):
self.root = [i for i in range(n)]
self.subt = [1] * n
def find(self, x):
if self.root[x] == x:
return x
else:
self.root[x] = self.find(self.root[x])
return self.root[x]
def union(self, x, y):
x, y = self.find(x), self.find(y)
x, y = min(x, y), max(x, y)
if x != y:
self.subt[x] += self.subt[y]
self.root[y] = x
def size(self, x):
return self.subt[self.find(x)]
n = int(input())
a = list(map(int, input().split()))
uf = UF(n)
for i in range(n-1):
if a[i+1] <= a[i] * 2:
uf.union(i, i+1)
print(max(uf.subt))
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int N = 2e5+5, MOD = 1e9+7;
const int dy[] = {0, 1, 0, -1, -1, -1, 1, 1};
const int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int i, j, k, t, n, a[N], ans;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for(i = 0; i < n; ++i) cin >> a[i];
for(i = 0, j = 0; i < n - 1; ++i) {
if(a[i + 1] <= 2 * a[i]) j++;
else {
ans = max(ans, j + 1);
j = 0;
}
}
cout << max(ans, j + 1);
return 0;
}
1498A - GCD Sum | 1277C - As Simple as One and Two |
1301A - Three Strings | 460A - Vasya and Socks |
1624C - Division by Two and Permutation | 1288A - Deadline |
1617A - Forbidden Subsequence | 914A - Perfect Squares |
873D - Merge Sort | 1251A - Broken Keyboard |
463B - Caisa and Pylons | 584A - Olesya and Rodion |
799A - Carrot Cakes | 1569B - Chess Tournament |
1047B - Cover Points | 1381B - Unmerge |
1256A - Payment Without Change | 908B - New Year and Buggy Bot |
979A - Pizza Pizza Pizza | 731A - Night at the Museum |
742A - Arpa’s hard exam and Mehrdad’s naive cheat | 1492A - Three swimmers |
1360E - Polygon | 1517D - Explorer Space |
1230B - Ania and Minimizing | 1201A - Important Exam |
676A - Nicholas and Permutation | 431A - Black Square |
474B - Worms | 987B - High School Become Human |