Cod sursa(job #1710539)

Utilizator S7012MYPetru Trimbitas S7012MY Data 29 mai 2016 11:23:34
Problema Carte2 Scor 100
Compilator cpp Status done
Runda Arhiva ICPC Marime 0.7 kb
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
 
int main() {
  ifstream f("carte2.in");
  ofstream g("carte2.out");
  int t;
  for(f>>t;t--;) {
    int a,b,v[3],ind[3],ok=0;;
    f>>a>>b>>v[0]>>v[1]>>v[2];
 
    ind[0]=0; ind[1]=1; ind[2]=2;
    do {
      //cout<<a<<' '<<b<<' '<<v[ind[0]]<<' '<<v[ind[1]]<<' '<<v[ind[2]]<<'\n';
      if(v[ind[0]]>a && v[ind[1]]>b) {
        ok=1;
        break;
      }
    }while(next_permutation(ind,ind+3));
    ind[0]=0; ind[1]=1; ind[2]=2;
    do {
      if(v[ind[0]]>a && v[ind[1]]>b) {
        ok=1;
        break;
      }
    }while(next_permutation(ind,ind+3));
    swap(a,b);
    if(ok) g<<"posibil\n";
    else g<<"imposibil\n";
  }
}