Cod sursa(job #1659077)

Utilizator RadduFMI Dinu Radu Raddu Data 21 martie 2016 23:09:53
Problema ChatNoir Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("chatnoir.in");
ofstream g("chatnoir.out");
int main()
{ int n,m,x,y,t,ok,np;
    f>>t;
    for(;t;t--)
    { f>>n>>m>>x>>y; ok=0;
      if (x==1 || x==n || y==1 || y==m) ok=1;
       else
       { np=min(min(x-1,y-1),min(n-x,m-y));
         if (np>4) ok=0; else ok=1;
       }
     if (ok) g<<"DA\n"; else g<<"NU\n";
    }
    return 0;
}