题解:CF2200B Deletion Sort
洛谷CF2200B || CodeForces 2200 B
简要题意
进行
思路
如果拿到的数组已经是递减的了,那答案显然是
否则,一定
因此如果输入数组非递减,答案一定为
评测记录
#include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int t = 1; cin >> t;
while (t--)
{
int n; cin >> n;
vector<int> a(n);
for (auto &i : a) cin >> i;
if (is_sorted(a.begin(), a.end())) cout << n << '\n';
else cout << "1\n";
}
}