From b90421028e550f1edc0f9a84f681227bf4cd5682 Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Sat, 15 Jul 2023 03:15:00 +0600 Subject: [PATCH] initial commit --- 1841B Keep it Beautiful/1841B.cpp | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 1841B Keep it Beautiful/1841B.cpp diff --git a/1841B Keep it Beautiful/1841B.cpp b/1841B Keep it Beautiful/1841B.cpp new file mode 100644 index 0000000..771b723 --- /dev/null +++ b/1841B Keep it Beautiful/1841B.cpp @@ -0,0 +1,53 @@ +#include +using namespace std; +using ll = long long; + + +void solve() +{ + int n; + cin>>n; + vectorv; + for(int i=0; i>x; + v.push_back(x); + } + string s="1"; + int last=v[0]; + bool increase=1; + for(int i=1; i=last && increase) + { + s.push_back('1'); + last=v[i]; + } + else if(v[i]=v[i] && increase) + { + increase=0; + last=v[i]; + s.push_back('1'); + } + else if(v[i]>=last && v[i]<=v[0]) + { + last=v[i]; + s.push_back('1'); + } + else + s.push_back('0'); + } + cout<> TC; + cin.ignore(); + while (TC--) solve(); +} \ No newline at end of file