Cod sursa(job #1708890)

Utilizator Spiromanii_MessiUNIBUCThrowTerror Spiromanii_Messi Data 28 mai 2016 10:07:24
Problema Carte2 Scor 100
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 1.02 kb
#include <bits/stdc++.h>

using namespace std;

# define pb push_back
# define mp make_pair
# define FORN( a , b , c ) for ( int a = b ; a <= c ; ++ a )
# define FORNBACK( a , b , c ) for ( int a = b ; a >= c ; -- a )

int main()
{
    ios :: sync_with_stdio ( false ) ;

    freopen( "carte2.in" , "r" , stdin ) ;
    freopen( "carte2.out" , "w" , stdout ) ;
    int t ;
    cin >> t ;
    while ( t -- ) {
        int a , b , c , d , e ;
        cin >> a >> b >> c >> d >> e ;
        int v [ 5 ] = { c , d , e } ;
        int ok = 0 ;
        do {
            int t [ 3 ] = { a , b } ;
            do {
                if ( t [ 0 ] < v [ 0 ] and t [ 1 ] < v [ 1 ] ) {
                    ok = 1 ;
                    break ;
                }
            }while ( next_permutation ( t , t + 2 ) ) ;
        }while ( next_permutation ( v , v + 3 ) ) ;
        if ( ok ) {
            cout << "posibil\n" ;
        }
        else {
            cout << "imposibil\n" ;
        }
    }
    return 0 ;
}