My issue
Ascending does not include same values right?
Like 1,2,3,4 is ascending but 1,2,2,3 is non-decreasing. Am I wrong in this? Can ascending also include same values?
My code
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef priority_queue<ll,vector<ll>,greater<ll>> minpq;
typedef priority_queue<ll> maxpq;
#define all(x) x.begin(),x.end()
#define yes cout<<YES<<endl
#define no cout<<NO<<endl
#define pb(x) push_back(x)
#define rsrt(x) sort(x.rbegin(),x.rend())
#define srt(x) sort(x.begin(),x.end())
#define fr(i,a,n) for(int i=a;i<n;i++)
const int m=1000000000+7;
/*class p{
public:
int a,b;
p(int x,int y){
a=x,b=y;
}
p(){}
};*/
/*class compa{
public:
bool operator()(p &t1,p &t2)
if(t1.b>t2.b){return true;}
return false;
};*/
void fun(){
ll n;
string s;
cin>>n>>s;
ll num=1,ans=0;
for(int i=0;i<n-1;i++){
if(s[i]==s[i+1]){
cout<<"NO"<<endl;
return;
}
}
cout<<"YES"<<endl;
return;
}
int main(){
int t;
cin>>t;
while(t--){
fun();
}
return 0;
}
Problem Link: FAIR_DISTRIB Problem - CodeChef