Advertisement
wym1111

Untitled

Nov 5th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. //#define int long long
  5. using ll = long long;
  6. const int N = 2e5 + 10;
  7. const ll mod = 1e9 + 7;
  8.  
  9. int n;
  10. ll a[N], f[70];
  11. ll f2[N * 40];
  12.  
  13. void pre () {
  14.     f[0] = 1;
  15.     for (int i = 1; i <= 60; i ++) {
  16.         f[i] = f[i - 1] * 2;
  17.     }
  18.     f2[0] = 1;
  19.     for (int i = 1; i < N * 40; i ++) {
  20.         f2[i] = f2[i - 1] * 2 % mod;
  21.     }
  22. }
  23.  
  24. void init () {
  25.     cin >> n;
  26.     for (int i = 1; i <= n; i ++) {
  27.         cin >> a[i];
  28.     }
  29. }
  30.  
  31. bool cmp (pair<int, ll> x, ll y) {
  32.     if (x.first > 32) return 1;
  33.     ll cur = f[x.first] * y;
  34.     return x.second <= y;
  35. }
  36.  
  37. void solve () {
  38.     init();
  39.    
  40.     deque<pair<int, ll>> q;
  41.     ll ans = 0;
  42.     for (int i = 1; i <= n; i ++) {
  43.         while (!q.empty() && cmp(q.back(), a[i])) {
  44.            
  45.         }
  46.         cout << ans << ' ';
  47.     }
  48.     cout << endl;
  49. }
  50.  
  51. signed main () {
  52.     ios::sync_with_stdio(0);
  53.     cin.tie(0);
  54.    
  55.     pre();
  56.    
  57.     int _ = 1;
  58.     cin >> _;
  59.     while (_ --) {
  60.         solve();
  61.     }
  62.    
  63.     return 0;
  64. }
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement