Untitled

limon23 avatar
limon23
c_cpp
02/20/2026 12:34 AM
3.4 KB
12
Indexable
    /**
     *   In the name of Allah, the Most Gracious, the Most Merciful.
     *   Author : Maksudul Hasan Limon
     *   Time & Date : 21:15:17 15/02/2026
     **/

    #include <bits/stdc++.h> 
    using namespace std;

    typedef long long ll;
    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<vi> vvi;
    typedef vector<vl> vvl;
    typedef pair<int,int> pii;
    typedef pair<double, double> pdd;
    typedef pair<ll, ll> pll;
    typedef vector<pii> vii;
    typedef vector<pll> vll;
    typedef double dl;

    #define endl '\n'
    #define pb push_back
    #define mp make_pair
    #define fi first
    #define se second
    #define INF (long long)2000000000000000000
    #define all(a) (a).begin(),(a).end()
    #define rall(a) (a).rbegin(),(a).rend()
    #define sz(x) (int)x.size()

    const double PI = acos(-1);
    const double eps = 1e-9;
    const int inf = 2000000000;
    const ll infLL = 9000000000000000000;
    #define MOD 1000000007

    #define optimize() ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    #define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
    #define file() freopen("input.","r",stdin);freopen("output.txt","w",stdout);

    #define mem(a,b) memset(a, b, sizeof(a))
    #define sqr(a) ((a) * (a))

    bool comp(pair<long long, long long> &p1, pair<long long, long long> &p2) {
        if(p1.first < p2.first && p1.first >= 7) return 1;
        else if(p1.first == p2.first) return p1.second < p2.second;
        else return 0;
    }

    // bool comp(pair<pair<string, string>, ll> p1, pair<pair<string, string>, ll>p2) {
    //     if(p1.first.second != p2.first.second) {
    //         return p1.first.second < p2.first.second;
    //     }
    //     if(p1.first.first != p2.first.first) {
    //         return p1.first.first < p2.first.first;
    //     }
    //     return p1.second > p2.second;
    // }

    // const int mx = 1e2 + 10;
    // ll a[mx];
    // ll b[mx];

void solve() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(ll i = 1; i <= n; i++) {
        if(a[i - 1] / (a[i - 1] & -a[i - 1]) != i / (i & -i)) {
            cout <<"NO\n";
            return;
        }
    }
    
    cout <<"YES\n";
}

int main() {
    optimize();
    int t;
    cin >> t;
    // int i = 0;
    while(t--) {
        // mem(v, 0);
        // cout << "Case " << ++i <<":" << endl;
        solve();
    }
}
Editor is loading...
Leave a Comment