Search found 383 matches

by emotional blind
Sun Mar 16, 2008 2:02 pm
Forum: Volume 100 (10000-10099)
Topic: 10041 - Vito's Family
Replies: 90
Views: 29687

By avoiding stl and cin, cout you can save some time.
And always try to use existing thread to post.
by emotional blind
Sun Mar 16, 2008 1:27 pm
Forum: Volume 114 (11400-11499)
Topic: 11417 - GCD
Replies: 11
Views: 5831

Its better to remove your code after getting accepted.
by emotional blind
Sun Mar 16, 2008 11:15 am
Forum: Volume 100 (10000-10099)
Topic: 10038 - Jolly Jumpers
Replies: 445
Views: 78459

Rajesh V,
initialize your array

Code: Select all

int c[n];
c[0] = 1; 
for(int i=1;i<n;++i)c[i]=0;
by emotional blind
Sun Mar 16, 2008 8:38 am
Forum: Volume 114 (11400-11499)
Topic: 11417 - GCD
Replies: 11
Views: 5831

your GCD function doesn't return if x!=0 && y!=0.

change

Code: Select all

   if(x<y)GCD(x,y%x);
   else GCD(y,x%y); 
to

Code: Select all

   if(x<y)return GCD(x,y%x);
   else return GCD(y,x%y); 
by emotional blind
Sun Mar 16, 2008 8:33 am
Forum: Volume 109 (10900-10999)
Topic: 10940 - Throwing cards away II
Replies: 28
Views: 14236

Re: Oh..

Obaida wrote: I think I have it... If n==1 then output will be 1.
So you got Accepted. Is it?
by emotional blind
Sun Mar 16, 2008 6:42 am
Forum: Volume 109 (10900-10999)
Topic: 10940 - Throwing cards away II
Replies: 28
Views: 14236

Re: Confusion

Obaida wrote: When n=1 then what will be the output... 1 or 0.
Problem Description wrote:Given is an ordered deck of n cards numbered 1 to n
by emotional blind
Sat Mar 15, 2008 8:13 pm
Forum: Volume 109 (10900-10999)
Topic: 10940 - Throwing cards away II
Replies: 28
Views: 14236

Re: Still WA...

Obaida wrote: I got WA... again & again... But where is my error...! Why this gives me WA...
carefully consider the case when n=1.
by emotional blind
Thu Mar 13, 2008 12:12 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 181664

Consider the case where i > j.
by emotional blind
Wed Mar 12, 2008 12:12 pm
Forum: Volume 100 (10000-10099)
Topic: 10003 - Cutting Sticks
Replies: 59
Views: 24249

Another approach:

remove memset part
and
insert

Code: Select all

	for(int i=0;i<=n+1;++i){
		for(int j=i;j<=n+1;++j){
			cache[p[i]][p[j]]=-1;
		}
	}
after this block

Code: Select all

for (int i=1; i<=n; ++i){
      cin >> p[i];
    } 
by emotional blind
Wed Mar 12, 2008 12:08 pm
Forum: Volume 100 (10000-10099)
Topic: 10003 - Cutting Sticks
Replies: 59
Views: 24249

Code: Select all

memset(cache, -1, sizeof(cache));
This part is costly. Try using O(n^2) memory. Here n<50, which is much smaller.
by emotional blind
Sun Mar 09, 2008 8:58 pm
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 45885

scott1991 wrote:WHAT AM I DOING WRONG?????
input can be as large as 2^32, but unsigned integer can hold 2^32-1 at maximum.
by emotional blind
Sun Mar 09, 2008 8:53 pm
Forum: Volume 100 (10000-10099)
Topic: 10071 - Back to High School Physics
Replies: 49
Views: 7491

scott1991 wrote:why am i getting re?

Code: Select all

#include <stdio.h>

int main()
{
long int v, t; 

while(scanf("%lld %lld", &v, &t)==2) 
{ 
printf("%lld\n", (2*t*v)); 
}
return 0;
} 
Type miss-match
you declared long int, but scan for long long.
by emotional blind
Sun Mar 09, 2008 8:38 pm
Forum: Volume 111 (11100-11199)
Topic: 11140 - Little Ali's Little Brother!
Replies: 28
Views: 14000

arif_pasha wrote:What would be the output for this kind of test case?

Code: Select all

3 3 1
**.
*.*
.**
5 5
**...
*....
.....
....*
...**
Output from my Accepted code

Code: Select all

No
by emotional blind
Sun Mar 09, 2008 6:04 pm
Forum: FAQ
Topic: Borring System
Replies: 20
Views: 17689

andmej wrote:What I miss the most is the e-mail received every time you submitted a problem.
Me too, very much.
by emotional blind
Sun Mar 09, 2008 8:02 am
Forum: Volume 110 (11000-11099)
Topic: 11067 - Little Red Riding Hood
Replies: 23
Views: 8536

add this condition

Code: Select all

if(x>w || y>h)return 0;

Go to advanced search