Cod sursa(job #2538832)
Utilizator | Andrei Feodorov Nashik | Data | 5 februarie 2020 10:44:42 |
---|---|---|---|
Problema | Nivele | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | simulare_miri | Marime | 0.55 kb |
//#include <iostream>
#include <fstream>
using namespace std;
long long cur[50005];
int main()
{
ifstream cin("nivele.in");
ofstream cout("nivele.out");
int t;
cin>>t;
while(t--){
int n,k=0,a;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a;
cur[++k]=a;
while(k!=1 and cur[k]==cur[k-1]){
cur[k-1]--;
k--;
}
}
if(k==1 and cur[k]==1){
cout<<"DA\n";
}
else
cout<<"NU\n";
}
return 0;
}