Cod sursa(job #1242390)

Utilizator diana97Diana Ghinea diana97 Data 14 octombrie 2014 13:25:06
Problema ChatNoir Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <iostream>
#include <fstream>

using namespace std;

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

bool sol(int n, int m, int x, int y) {
    return min(min(x - 1, y - 1), min(n - x, m - y)) <= 4;
}

void rezolva() {
    int t, n, m, x, y;
    f >> t;
    while (t--) {
        f >> n >> m >> x >> y;
        if (sol(n, m, x, y)) g << "DA\n";
        else g << "NU\n";
    }
}

int main() {
    rezolva();
    return 0;
}