方师解
2024-02-25 15:21:07
发布于:北京
10阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
void solve()
{
long long n,k,x,last;
bool flag = true;
cin >> n >> k >> last;
for(int i = 2 ; i <= n ; i ++ ){
cin >> x;
if(last > x)flag = false;
last = x;
}
if(flag){
cout << "YES" << endl;
return ;
}
if(k>1)cout << "YES" << endl;
else cout << "NO" << endl;
}
int main()
{
int t;
cin >> t;
while(t--)
{
solve();
}
return 0;
}
这里空空如也
有帮助,赞一个