Cod sursa(job #2706535)

Utilizator PopescuAndreiAlexandruPopescu Andrei Alexandru PopescuAndreiAlexandru Data 15 februarie 2021 11:03:44
Problema Carte2 Scor 100
Compilator cpp-64 Status done
Runda Arhiva ICPC Marime 0.85 kb
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>

using namespace std;

ifstream fin("carte2.in");
ofstream fout("carte2.out");

const int N = 5;

int T, A, B, v[N];

bool Check(int l, int c)
{
    for (int i = 1; i <= 3; i++)
        {
            for (int j = 1; j <= 3; j++)
                {
                    if (i != j)
                        {
                            if ((l < v[i] && c < v[j]) || (c < v[i] && l < v[j]))
                                return true;
                        }
                }
        }
    return false;
}

int main()
{
    fin >> T;
    while (T--)
        {
            fin >> A >> B >> v[1] >> v[2] >> v[3];
            if (Check(A, B))
                fout << "posibil" << '\n';
            else
                fout << "imposibil" << '\n';
        }
}