Cod sursa(job #1709013)

Utilizator utcn_roxanaalexfloUTCN ROXANA ALEX FLO utcn_roxanaalexflo Data 28 mai 2016 10:34:57
Problema Carte2 Scor 100
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 0.98 kb
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <stdlib.h>
#include <cstdio>
#include <fstream>

using namespace std;

bool smaller(int a, int b, int c, int d) {
	return (a < c && b < d);
}

bool isPossible(int a, int b, int c, int d, int e) {
	if(smaller(a, b, c, d)){
		return true;
	} 
	if (smaller(a, b, c, e)) {
		return true;
	} 
	if (smaller(a, b, d, e)) {
		return true;
	}

	return false;
}

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

	ifstream inFile("carte2.in");
	ofstream outFile("carte2.out");

	int T;
	int A, B, C, D, E;
	bool result;
	inFile >> T;

	for (int t = 0; t < T; t++) {
		inFile >> A >> B >> C >> D >> E;
		

		result = isPossible(A, B, C, D, E);
		result |= isPossible(B, A, C, D, E);

		if (result) {
			outFile << "posibil" << endl;
		}
		else {
			outFile << "imposibil" << endl;
		}
	}

	


	inFile.close();
	outFile.close();

    return 0;
}