## Search found 31 matches

Sun Jun 04, 2006 5:04 pm
Forum: Volume 110 (11000-11099)
Topic: 11045 - My T-shirt suits me
Replies: 18
Views: 10189

### 11045 - My T-shirt suits me

What is the approach to solve this problem??
Is it simple backtracking or is there some trick?
People have solved it in very less time.
So i guess there might be some trick.
Sat Jun 03, 2006 11:17 am
Forum: Volume 101 (10100-10199)
Topic: 10154 - Weights and Measures
Replies: 60
Views: 39891

### getting WA

I am first sorting the input by strength and then by weight. Then i am calculating their difference, followed by LIS on the difference. Is this algo wrong?? If yes , where? here's my code: #include<stdio.h> #include<algorithm> using namespace std; typedef struct t{ int w; int s; }turtles; bool compa...
Fri May 26, 2006 7:40 pm
Forum: Volume 109 (10900-10999)
Topic: 10990 - Another New Function
Replies: 32
Views: 15175
I modified my code a bit and wow!!! got accepted in little over 1 sec. Now i am ranked 9th in this problem.
Sun May 21, 2006 10:12 am
Forum: Volume 104 (10400-10499)
Topic: 10432 - Polygon Inside A Circle
Replies: 62
Views: 20001
may be the WA's came bcoz u took the value of PI from any other source(may be u have searched google or seen math.h).
In general always use PI=2*acos(0.0). you wont get precision errors then.
Sat May 20, 2006 12:36 pm
Forum: Volume 109 (10900-10999)
Topic: 10990 - Another New Function
Replies: 32
Views: 15175
thats a great algorithm... going to implement it and i hope it wont give TLE.
thanx mamun (and ofcourse chunyi81).

Edited:
Got it accepted in around 2.1 secs.!!!
thanx a lot again.
Sat May 20, 2006 7:23 am
Forum: Volume 109 (10900-10999)
Topic: 10990 - Another New Function
Replies: 32
Views: 15175

### Getting TLE

Smbd plz help me optimize my code. Here it is #include<stdio.h> #include<math.h> int prime[1414],pr_nums[300],cnt; int dep[2000001],sodf[2000001]; void find_prime(){ int i,j,k; for(i=0;i<1414;i++){ if(i%2==1) prime[i]=1; else prime[i]=0; } pr_nums[0]=2; for(i=3;i<38;i+=2){ if(prime[i]){ k=i*2; for(j...
Fri May 19, 2006 5:43 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 31881

### 10394 Twin Primes TLE

I am using sieve to generate prime numbers and then storing the twin primes. (Pre calculation). This alone takes something around 10.8 seconds . Please help to make my program run faster. I have done everything i know to optimize my algorithm (at first it took around 15.5 seconds) but now I can't re...
Mon May 15, 2006 8:07 am
Forum: Volume 106 (10600-10699)
Topic: 10650 - Determinate Prime
Replies: 67
Views: 24331
I am getting 181 sequences instead of 162. They are : 3 5 7 47 53 59 151 157 163 167 173 179 199 211 223 251 257 263 257 263 269 367 373 379 557 563 569 587 593 599 601 607 613 647 653 659 727 733 739 941 947 953 971 977 983 1097 1103 1109 1117 1123 1129 1181 1187 1193 1217 1223 1229 1361 1367 1373 ...
Sun May 14, 2006 9:25 pm
Forum: Volume 110 (11000-11099)
Replies: 43
Views: 16646

### getting Runtime error

Hi all, I am getting either Runtime error or Compile error everytime i submit the code. Here it is : #include<cstdio> #include<ctype.h> #include<iostream> int max(int a,int b){ if(a>b) return a; return b; } int main(){ char string[50]; int num1,num2,c,cnt,test,i,l,sum,j,cas=0; int i1,i2,i3,i4,i5,i6;...
Wed May 10, 2006 5:41 pm
Forum: Volume 109 (10900-10999)
Topic: 10930 - A-Sequence
Replies: 102
Views: 31509
i submitted the same code again and got accepted.
i just didnt use sorting.
although i got WA some 4-5 times more.
the same code then gave runtime error (although my array size was 1050.. which means that input contains integers gretaer than 1050).
neways noe its accepted.
Wed May 10, 2006 1:49 pm
Forum: Volume 109 (10900-10999)
Topic: 10930 - A-Sequence
Replies: 102
Views: 31509

### 10930 - A-Sequence

i used the following algorithm... first i printed the given input. then sorted it. then i checked whether a number can be expressed as a sum of two or more numbers. but it gave wrong answer. and 1 more thing.. do we really need to sort the input? because that can change the relative order of the inp...
Wed May 10, 2006 11:47 am
Forum: Volume 109 (10900-10999)
Topic: 10916 - Factstone Benchmark
Replies: 10
Views: 5218

12
20
20
3
3
254016
134480
254016
Wed May 10, 2006 11:18 am
Forum: Volume 109 (10900-10999)
Topic: 10916 - Factstone Benchmark
Replies: 10
Views: 5218
so that is what i am saying..
3 for the set of years 1960-1969
5 for 1970-1979
and so on.
isn't that rite?
Wed May 10, 2006 1:12 am
Forum: Volume 109 (10900-10999)
Topic: 10916 - Factstone Benchmark
Replies: 10
Views: 5218
isnt the answer going to be
the 21 values
for the set of years??
if yes then why am i getting WA?otherwise where am i wrong?
is there any boundary condition?
Sun May 07, 2006 7:04 pm
Forum: Volume 4 (400-499)
Topic: 443 - Humble Numbers
Replies: 82
Views: 6882
that means if i change the condition to (pro<(long long)2000000000 && pro<(long long)0) then wud it be ok? ... neways i think that this cud have been the problem bcoz i changed my variables from int to long long and now the program gives correct output. i havent submitted it yet but now it might be ...