Cod sursa(job #1708889)

Utilizator eu3neuomManghiuc Teodor-Florin eu3neuom Data 28 mai 2016 10:06:26
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;

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

inline void Solve(){
    int a, b, c, d, e;
    fin >> a >> b >> c >> d >> e;
    if(a < c){
        if(b < d || b < e){
            fout << "posibil\n";
            return;
        }
    }
    if(a < d){
        if(b < c || b < e){
            fout << "posibil\n";
            return;
        }
    }
    if(a < e){
        if(b < c || b < d){
            fout << "posibil\n";
            return;
        }
    }
    if(b < c){
        if(a < d || a < e){
            fout << "posibil\n";
            return;
        }
    }
    if(b < d){
        if(a < c || a < e){
            fout << "posibil\n";
            return;
        }
    }
    if(b < e){
        if(a < c || a < d){
            fout << "posibil\n";
            return;
        }
    }
    fout << "imposibil\n";
    return;
}

int main(){
    int t;
    fin >> t;
    while(t--){
        Solve();
    }
    return 0;
}