I got RunTime Error...
as a general in the problem is mentioned that (j < 10001) so it means that we dont want to produce more than 10000 character for each BFS !
can anybody say that this is true !? or what's the problem of my code ?

Code: Select all
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
string bfs[29];
void pr(int n , int a , int b)
{
string s = bfs[n].substr(a , b-a+1);
cout << s << endl;
}
int main()
{
bfs[0] = "0";
bfs[1] = "1";
for(int i = 2 ; i < 29 ; i++)
{
bfs[i] = bfs[i-2] + bfs[i-1];
}
int t , n , a , b;
scanf("%d",&t);
for(int pp = 0 ; pp < t ; pp++)
{
scanf("%d %d %d",&n , &a , &b);
if(n > 28)
{
if(n%2 == 0)
pr(28 , a , b);
else
pr(27 , a , b);
}
else
{
pr(n , a , b);
}
}
return 0;
}