Pagini recente » Cod sursa (job #1492971) | Cod sursa (job #997924) | Cod sursa (job #1156082) | Cod sursa (job #2789983) | Cod sursa (job #2558091)
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
ifstream f("nivele.in");
ofstream g("nivele.out");
// Seria borderlands e cea mai naspa din toata istoria gaming-ului, can't change my mind
int steve[50001];
int main()
{
int ciururi;
f>>ciururi;
while (ciururi--)
{
int top=0,n,x,y;
f>>n;
f>>x;
steve[++top]=x;
for (int i=2; i<=n; i++)
{
f>>y;
steve[++top]=y;
while (top>1 && steve[top]==steve[top-1])
{
steve[--top]-=1;
}
x=y;
}
(steve[top] == 1 && top == 1) ? g<<"DA" : g<<"NU";
g<<'\n';
}
return 0;
}