Cod sursa(job #844545)
| Utilizator | Data | 29 decembrie 2012 15:00:14 | |
|---|---|---|---|
| Problema | Nivele | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <fstream>
#include <vector>
using namespace std;
ifstream F("nivele.in");
ofstream G("nivele.out");
int T,N,A;
vector< int > V;
int main()
{
F>>T;
while ( T-- )
{
F>>N;
while ( N-- )
{
F>>A;
while ( V.size() && V.back()==A )
V.pop_back(), --A;
V.push_back( A );
}
if ( V.size()==1 && V.back()==1 )
G<<"DA\n"; else G<<"NU\n";
while ( V.size() )
V.pop_back();
}
}
