Why is Dynamic Programming solution giving TLE?
#include<bits/stdc++.h>
using namespace std;
long long int arr[100001];
inline void scani(int *a){
register char c=0;
while (c<33) c=getchar();
*a=0;
while (c>33)
{
*a=a10+c-‘0’;
c=getchar();
}
}
int main(void)
{
int t,i,n;
scani(&t);
arr[0]=0;
arr[1]=2;
arr[2]=5;
while(t–)
{
scani(&n);
for(i=3;i<=n;++i)
{
arr[i]=i+i+1+arr[i-2];
}
printf("%lld\n",arr[n]);
}
}