Codeforces 1604B - XOR Specia-LIS-t Solution

 Solution in C++:    

///La ilaha illellahu muhammadur rasulullah

///******Bismillahir-Rahmanir-Rahim******///

///Abul Hasnat  Tonmoy

///Department of CSE,23rd batch

    ///Islamic University,Bangladesh

    1. #include <bits/stdc++.h>
    2. using namespace std;
    3. int main()
    4. {
    5. int t,i,n,c;
    6. cin>>t;
    7. while(t--)
    8. {
    9. cin>>n;
    10. int a[n+1];
    11. c=0;
    12. for(i=0; i<n; i++)
    13. cin>>a[i];
    14. if(n%2==0)
    15. cout<<"YES"<<endl;
    16. else
    17. {
    18. for(i=0; i<n-1; i++)
    19. {
    20. if(a[i+1]<=a[i])
    21. {
    22. c=1;
    23. break;
    24. }
    25.  
    26. }
    27. if(c==1)
    28. cout<<"YES"<<endl;
    29. else
    30. cout<<"NO"<<endl;
    31.  
    32. }
    33. }
    34. }

    No comments

    Most View Post

    Recent post

    Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

      Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

    Powered by Blogger.