Cod sursa(job #2011500)
Utilizator | Andrei Cotor Andrei_Cotor | Data | 16 august 2017 14:33:37 |
---|---|---|---|
Problema | Twoton | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva ICPC | Marime | 0.53 kb |
/*
Simulez liniar.
*/
#include<fstream>
using namespace std;
ifstream fi("twoton.in");
ofstream fo("twoton.out");
int n,i,A[100001],nr,count;
int main()
{
fi>>n;
for(i=1; i<=n; i++)
fi>>A[i];
nr=A[n];
count=1;
for(i=n-1; i>=1; i--)
{
if(A[i]<nr)
{
nr=A[i];
count=(1+count)%19997;
}
else
{
count=(1+2*count)%19997;
}
}
fo<<count%19997<<"\n";
fi.close();
fo.close();
return 0;
}