Cod sursa(job #999315)

Utilizator rares96cheseliRares Cheseli rares96cheseli Data 19 septembrie 2013 21:37:32
Problema Nivele Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <fstream>
using namespace std;
ifstream f("nivele.in");
ofstream g("nivele.out");

int t, n, st[50005];

int main()
{
    f>>t;
    while (t--)
    {
        f>>n; int top=n;
        fill(st+1, st+n+1, 0);
        for (int i=1; i<=n; ++i) f>>st[i];
        while (top>0 && st[top]==st[top-1])
            --top, --st[top];
        if (top>1) g<<"NU\n";
            else g<<"DA\n";
    }
    return 0;
}