Pagini recente » Monitorul de evaluare | Cod sursa (job #1933767) | Cod sursa (job #1710885) | Cod sursa (job #113354) | Cod sursa (job #638747)
Cod sursa(job #638747)
#include <fstream>
using namespace std;
ifstream f("chatnoir.in");
ofstream g("chatnoir.out");
int t,i,n,m,x,y;
bool iese(int l,int c,int x,int y) {
if (x==l || y==c) return true;
int dl=min(x-1,l-x);
int dc=min(y-1,c-y);
if (dl+dc<=2) return true;
if (min(dl,dc)<5) return true;
return false;
}
int main () {
f >> t;
for (i=1;i<=t;i++) {
f >> n >> m >> x >> y;
if (iese(n,m,x,y)) g << "DA" << '\n';
else g << "NU" << '\n';
}
f.close();g.close();
return 0;
}