1772B - Matrix Rotation - CodeForces Solution


brute force implementation *800

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>

using namespace std;
    
#ifdef __local_leywar
#include "../../debug/debugger.h"  
#endif
    
#define int long long
#define endl '\n'
    
const int INF = 2e9,
            MOD = 1e9+7,
            INFLL = 1e18;
    
using pii = pair<int, int>;
using ld = long double;
using ll = long long;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
   
    int tc; 
    cin >> tc; 
    while(tc--)
    {
        vector<int> ar(4);
        
        for(auto &i: ar)
            cin >> i ;

        bool sol = false;

        for(int i = 0 ; i < 4 ; i++)
        {
            vector<int> temp_ar = {ar[2], ar[0], ar[3], ar[1]};
            ar = temp_ar;

            if(ar[0] < ar[1] and ar[0] < ar[2] and ar[3] > ar[1] and ar[3] > ar[2])
                sol = true;
        }

        cout << (sol ? "YES" : "NO") << endl ;
    }

    return 0;
}


Comments

Submit
0 Comments
More Questions

Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game
Char Sum
Two Strings
Anagrams
Prime Number
Lexical Sorting Reloaded
1514A - Perfectly Imperfect Array