Cod sursa(job #1554092)

Utilizator CTI_KnightCir Constantin CTI_Knight Data 20 decembrie 2015 21:32:23
Problema ChatNoir Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
# include <fstream>
# include <algorithm>

using namespace std;

ifstream f ( "chatnoir.in" );
ofstream g ( "chatnoir.out" );

int main ()
{
    int t, n, m, x, y, mn;

    f >> t;

    for ( int i = 1; i <= t; ++ i )
    {
        f >> n >> m >> x >> y;

        mn = n - x;
        if ( x - 1 < mn )
            mn = x - 1;
        if ( m - y < mn )
            mn = m - y;
        if ( y - 1 < mn )
            mn = y - 1;

        if ( mn <= 4 )
            g << "DA";
        else
            g << "NU";
        g << "\n";


    }
        return 0;
}