Cod sursa(job #1466784)

Utilizator eu3neuomManghiuc Teodor-Florin eu3neuom Data 30 iulie 2015 13:49:56
Problema Amlei Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.77 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("amlei.in");
ofstream fout("amlei.out");

void solve(const int &n, int &a, const int &lim){
    bool good;
    int x;
    for(int i = 1; i <= lim; i++){
        good = true;
        for(int j = 1; j <= n; j++){
            fin >> x;
            if(x < 0){
                good = false;
                a = max(0, a);
            }
        }
        if(good == true){
            a = 1;
        }
    }
}

int main(){
    int n, t, u, a, b;
    while(fin >> n){
        fin >> t >> u;
        a = b = -1;
        solve(n, a, t);
        solve(n, b, u);
        if(a == b){
            fout << "DA\n";
        } else {
            fout << "NU\n";
        }
    }
    return 0;
}