Subscribe Us

Responsive Advertisement

Advertisement

1635C Differential Sorting codeforces slution in cpp

 

1635C Differential Sorting codeforces slution in cpp

by ujjal roy




#include<bits/stdc++.h>

using namespace std;

main()

{

    long long int t,n,i;

    cin>>t;

    while(t--)


     {

         cin>>n;

         vector<long long int> v(n);

         for(i=0;i<n;i++) cin>>v[i];

         if(is_sorted(v.begin(),v.end())) cout<<"0"<<endl;

         else if((v[n-1]==v[n-2])||((v[n-1]>v[n-2])&&v[n-1]>=0))

         {

             cout<<n-2<<endl;

             for(i=1;i<=n-2;i++)

             {

                 cout<<i<<" "<<n-1<<" "<<n<<endl;

             }

         }

         else cout<<"-1"<<endl;


     }

    return 0;

}


Post a Comment

0 Comments