Search found 405 matches

by anupam
Thu Sep 23, 2004 10:22 pm
Forum: Other words
Topic: nasim
Replies: 1
Views: 1173

Post the problem Number : Porblem Name: The algorithm you have used: post the code in C or C++ option while posting and if needed to post. Then we can help you:wink:
by anupam
Thu Sep 23, 2004 10:21 pm
Forum: Other words
Topic: nasim
Replies: 1
Views: 1219

Interesting :lol:
by anupam
Thu Sep 23, 2004 10:06 pm
Forum: Volume 107 (10700-10799)
Topic: 10713 - Map
Replies: 16
Views: 5919

gvcormac wrote: Where do you ensure that you stay on the island?
OOPS! I forgot the case. Thanks for the line. Got AC now. :wink:
by anupam
Thu Sep 23, 2004 10:00 pm
Forum: Volume 107 (10700-10799)
Topic: 10717 - Mint
Replies: 3
Views: 5103

Input: 4 10 54 115 28 103 32 1186 631 812 368 1151 508 540 930 817 28 8 80 104 100 91 41 127 33 130 83 165 16 162 74 76 39 124 141 44 38 169 147 70 106 129 81 25 79 140 964 360 1108 243 1064 160 733 656 52 6 86 117 137 121 33 152 82 107 180 120 182 120 164 20 40 62 41 145 142 73 170 173 165 85 132 2...
by anupam
Thu Sep 23, 2004 9:29 pm
Forum: Volume 107 (10700-10799)
Topic: 10720 - Graph Construction
Replies: 49
Views: 30964

Re: 10720

schindlersp wrote: what is the init value of vImp?
what sort have you used?
by anupam
Thu Sep 23, 2004 9:20 pm
Forum: Volume 107 (10700-10799)
Topic: 10720 - Graph Construction
Replies: 49
Views: 30964

Per wrote:it has to be non-increasing, and its sum has to be even.
What I did for that,
checked the case where the sum is not even.
sort the values in non-increasing order using O(n^2) alg.
Then checked the Erdos and Gallai alg.
and nothing more.
by anupam
Thu Sep 23, 2004 9:14 pm
Forum: Volume 107 (10700-10799)
Topic: 10718 - Bit Mask
Replies: 29
Views: 9390

So, what may be the algorithm that abishek described. I think I didn't understand it properly. Can you help how to proceed?
by anupam
Wed Sep 22, 2004 11:27 pm
Forum: Volume 107 (10700-10799)
Topic: 10718 - Bit Mask
Replies: 29
Views: 9390

abishek, I used as follows: (but got WA) 1. convert N to binary 2. for up to low of binary N { tmp=prev. val+2^i; iif(tmp<l) {val=tmp;continue;} if(tmp>u) continue; if(a ==0) val=tmp; } 3. before step 2 I used the folowing special cases: let n = no. of bit in N and m=no. of bit in M if(n==m) and all...
by anupam
Wed Sep 22, 2004 10:30 pm
Forum: Volume 107 (10700-10799)
Topic: 10720 - Graph Construction
Replies: 49
Views: 30964

Hi abishek, I used Erdos and Gallai theorem to get AC and got the place just after U :D What I did (check yours): 1. sort the input 2. there is no negative value 3. check for degree sequence degree sequence as per said 4. if(n==1 && a[1]>0){printf("Not possible\n");continue;} 5. checked the theorem ...
by anupam
Wed Sep 22, 2004 2:00 am
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 10081

OOPs, I think I am counting things twice. Is it the case? Adrian, I think I missed the case 1313. :oops:
by anupam
Wed Sep 22, 2004 1:44 am
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 10081

Please help to find what's wrong with my formula: for n>2, there are n-1 ways to put 13. there are total combination (base-1)*pow(base,n-1) as leading 0 is not allowed. again if there are four digits (let A B C D we can put 13 in AB, BC, CD positions. Incase of AB (Only case where 13 is in the first...
by anupam
Wed Sep 22, 2004 12:36 am
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 10081

10722 - Super Lucky Numbers

I have used the formula for each base and n for n>2 : answer= (base-1)base^(n-1) - base^(n-2) - (n-2)(base-1)base(n-3) for n=2: answer= base(base-1)-1 for n=1 answer=base (confused: (base-1) ?) got TLE. Then I used DP to calculate the whole table for each base^n and then used the same formula. but t...
by anupam
Wed Sep 22, 2004 12:14 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 190900

Thanks Per for confirming the case. I was in a little doubt about cout and scanf. I have been said that, if you use stdio and iostraem together, they for the synchronizing problem they may not work together(thats why I used the word "may":wink: ). But, now I see, it's just the opposite. Thanks again...
by anupam
Tue Sep 21, 2004 10:10 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 190900

Removed after Per's clarification...
by anupam
Tue Sep 21, 2004 10:08 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 190900

oops, sorry. Here is what I wanted to say: 1. If the break condition was not checked by a program it will get OLE. For example, in the problem statement it was told that input will end with two zeroes, but in your program you used while(scanf("%d%d",&a,&b)!=EOF){ } then the program may get OLE if th...

Go to advanced search