Cod sursa(job #2239975)

Utilizator PondorastiAlex Turcanu Pondorasti Data 12 septembrie 2018 09:05:41
Problema ChatNoir Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <fstream>

using namespace std;

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


int teste;
int n, m, x, y;

const int MAX_Dist = 5;
const string da = "DA\n", nu = "NU\n";

int main() {
    
    in >> teste;
    
    while (teste--) {
        in >> n >> m >> x >> y;
        
        if (x <= MAX_Dist) {
            out << da;
        } else if (y <= MAX_Dist) {
            out << da;
        } else if (n - x + 1 <= MAX_Dist) {
            out << da;
        } else if (m - y + 1<= MAX_Dist) {
            out << da;
        } else {
            out << nu;
        }
    }
    
    return 0;
}