Pagini recente » Cod sursa (job #2312174) | Cod sursa (job #635894) | Cod sursa (job #2748276) | Cod sursa (job #1641934) | Cod sursa (job #2239975)
#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;
}