B

Anonymous
c_cpp
02/28/2026 12:14 PM
864 B
30
Indexable
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define int long long
const int N = 1e6 + 10;
const int inf = 1e15;
const int mod = 998244353;

inline void solve(){
    
    int n;cin >> n;
    vector<int> v(n);

    for(auto &x : v) cin >> x;

    bool ok = 1;
    for(int i = 0;i < n - 1;i += 1){
        ok &= (v[i] <= v[i + 1]);
    }

    if(ok){
        cout << n;
    }
    else cout << 1;

}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t;
    while(t--){
        solve();
        cout << '\n';
    }
    return 0;
}
Editor is loading...
Leave a Comment