Pagini recente » Cod sursa (job #1681537) | Cod sursa (job #2438224) | Cod sursa (job #1263437) | Cod sursa (job #272917) | Cod sursa (job #999319)
Cod sursa(job #999319)
#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>1 && st[top]==st[top-1])
--top, --st[top];
if (top==1 && st[1]==1) g<<"DA\n";
else g<<"NU\n";
}
return 0;
}