My issue
WA issues for right answer
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int n, a[100], c=0, b=0;
cin>>n;
for(int i=0; i<n; i++){
cin>>a[i];
}
for(int i=0; i<n-1; i++){
if(a[i]>a[i+1]){
b++;
}
}
for (int i = 0; i < n; i++) {
for (int j = i+1; j < n; j++) {
if(a[i]>a[j]){
c++;
}
}
}
if(b==c){
cout<<"yes\n";
}
else
std::cout << "no" << std::endl;
}
return 0;
}
Problem Link: LEPERMUT Problem - CodeChef