Cod sursa(job #1708926)

Utilizator UTCN_FrunzaUTCN Lazar Nitu Petruta UTCN_Frunza Data 28 mai 2016 10:16:09
Problema Carte2 Scor 100
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 0.9 kb
#include <bits/stdc++.h>

#define POSIBIL "posibil\n"
#define IMPOSIBIL "imposibil\n"

using namespace std;

int tests, a, b, c, d, e;

int main() {
    freopen("carte2.in", "r", stdin);
    freopen("carte2.out", "w", stdout);

    scanf("%d", &tests);

    for (int test = 0; test < tests; ++test) {
        scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);

        //c x d
        if ((a < c && b < d) || (a < d && b < c)) {
            printf("%s", POSIBIL);
            continue;
        }

        // c x e
        if ((a < c && b < e) || (a < e && b < c)) {
            printf("%s", POSIBIL);
            continue;
        }

        // d x e
        if ((a < d && b < e) || (a < e && b < d)) {
            printf("%s", POSIBIL);
            continue;
        }

        printf("%s", IMPOSIBIL);
        continue;
    }

    fclose(stdin);
    fclose(stdout);

    return 0;
}