diff --git a/Crossing_Blocks.cpp b/Crossing_Blocks.cpp new file mode 100644 index 0000000..7197603 --- /dev/null +++ b/Crossing_Blocks.cpp @@ -0,0 +1,46 @@ +#include +using namespace std; +#define ll long long +#define rep(i,a,n) for(ll i=a;i>n; + vector v(n); + map mp; + rep(i,0,n) + { + cin>>v[i]; + mp[v[i]]++; + } + vector v1=v; + sort(v1.begin(),v1.end()); + if(v[0]!=v1[n-1]) + { + cout<<-1<<'\n'; + return; + } + ll count=0; + ll mx=-1; + for(int i=n-1;i>=1;i--) + { + if(v[i]>mx) + { + mx=v[i]; + count++; + } + } + cout<>t; + while(t--) + { + solve(); + + } + return 0; +} \ No newline at end of file