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.
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: 12770
- Sat Jun 03, 2006 11:17 am
- Forum: Volume 101 (10100-10199)
- Topic: 10154 - Weights and Measures
- Replies: 60
- Views: 47946
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: 18390
- Sun May 21, 2006 10:12 am
- Forum: Volume 104 (10400-10499)
- Topic: 10432 - Polygon Inside A Circle
- Replies: 62
- Views: 28051
- Sat May 20, 2006 12:36 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10990 - Another New Function
- Replies: 32
- Views: 18390
- Sat May 20, 2006 7:23 am
- Forum: Volume 109 (10900-10999)
- Topic: 10990 - Another New Function
- Replies: 32
- Views: 18390
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: 45970
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: 36070
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)
- Topic: 11032 - Function Overloading
- Replies: 43
- Views: 21849
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: 59679
- Wed May 10, 2006 1:49 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10930 - A-Sequence
- Replies: 102
- Views: 59679
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: 7140
my answers
12
20
20
3
3
254016
134480
254016
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: 7140
- Wed May 10, 2006 1:12 am
- Forum: Volume 109 (10900-10999)
- Topic: 10916 - Factstone Benchmark
- Replies: 10
- Views: 7140
- Sun May 07, 2006 7:04 pm
- Forum: Volume 4 (400-499)
- Topic: 443 - Humble Numbers
- Replies: 82
- Views: 17254