Page 9 of 12

Posted: Tue Oct 03, 2006 7:14 am
by newton
i changed the size of the array but still got runtime error.
what is my fault? may u check it again plz.

Posted: Thu Oct 05, 2006 4:31 am
by daveon

Code: Select all

char str1[1000001];
int    str2[1000001];

Code: Select all

char str1[1000001];
char str2[1000001];
and make these global variables.

Then change

Code: Select all


Code: Select all

Which is now a little more robust. And also, add #include <string.h>.

Posted: Thu Oct 05, 2006 8:46 am
by newton
dear davion

i have done all the changes u told but ACM (stupid) Compiler gave me WA. i am really in a great trouble with the chilly problem. May u help again.

advanced thanx.

Posted: Thu Oct 05, 2006 5:38 pm
by Vexorian
your alg has a little flaw, try this: (char would overflow)

Code: Select all

500 501
The correct answer for that input is Yes.

Posted: Sat Oct 07, 2006 6:58 am
by newton

Posted: Sat Oct 07, 2006 6:05 pm
by Vexorian
Maybe your compiler does not have an 8 bits size char, or maybe it is another compiler related issue.

I compiled your program with gcc (which is the compiler the online judge uses) and it failed with that input

Posted: Mon Mar 12, 2007 12:45 pm
by newton
why dont you give me simple I/O which can help me to seek out my problem. please check my code. find if there any locical error.
my Turbo c++ compiler is so poor to find critical error.

Code: Select all

               please help or i will die

newton................................ simply the best

Posted: Mon Mar 12, 2007 12:59 pm
by newton
please help me!

goto the link please ... 9623#59623

Posted: Mon Mar 12, 2007 4:03 pm
by rio
Bug here.

Code: Select all

 printf("Case: %d\n",++Case); 
And I think the str2 should be int.
calm down.

Posted: Thu Mar 15, 2007 10:23 am
by newton
devion and rio,

your comments are contradictory to each other!
what should i do
should str2 be in char or int type?
plz clarify me.
i am in great trouble.

Posted: Tue May 01, 2007 7:41 am
by legnaleurc
I have found why I got TLE.

Code: Select all

		getline(cin, line);
Because the last char. of input file could be space, it won't get EOF
This cause limitless loop

Use while(getline(cin, line)) instead of while(!cin.eof()) and I got Accepted. plzzzzzzzzz

Posted: Sat Jun 09, 2007 3:23 pm
for god"s sake can anyone tell y the hell i am getting out of time.......

plzzzzzzzzz help

Code: Select all

using namespace std;
int main()
int count=0;
string s;
return 0;
if(s[0]==' ')
return 0;
printf("Case %i:\n",count);
int a,b,c;
for(int i=1;i<=a;++i)
char temp=s[b];
char a1=s[b];


Posted: Sat Jun 09, 2007 5:46 pm
by Jan
Your algorithm is not ok for this problem. For each query you dont have to run any loop. Just initially check the whole pattern and use some technique. Then you can solve each query in just O(1).

Hope it helps.

wa now

Posted: Sat Jun 09, 2007 7:06 pm
yes i totally underestimated this this time i am sure my algo is right(hope so)

plzzzzzzzz jan telll me y i m getting WA...........

which cases i am missing...................

Code: Select all

/*code removed*/

Posted: Sun Jun 10, 2007 11:37 am
by Jan
I think your code is correct as well as your algorithm. So, try submitting it again. And don't forget to remove your code.