Search found 1332 matches

by Jan
Mon Jul 28, 2008 5:29 pm
Forum: Algorithms
Topic: Getting TLE again and again
Replies: 1
Views: 755

Re: Getting TLE again and again

Search the board first. And if you find no thread then open a new one with problem number and name.
by Jan
Fri Jul 25, 2008 12:45 am
Forum: Volume 3 (300-399)
Topic: 333 - Recognizing Good ISBNs
Replies: 166
Views: 21806

Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

May be there are no such cases.
by Jan
Fri Jul 25, 2008 12:43 am
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 37057

Re: 583 - Prime Factors

Did you notice this?

Code: Select all

VI v(n);
You are giving -2147483647 as n. vector<int> v(-2147483647). That's why your program crashed.
by Jan
Tue Jul 22, 2008 11:29 pm
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 37057

Re: 583 - Prime Factors

Can you post your full code?
by Jan
Mon Jul 21, 2008 9:41 pm
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 37057

Re: 583 - Prime Factors

(+-)2147483647 both fit into normal int.
by Jan
Tue Jul 15, 2008 9:12 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 32521

Re: 10394 - Twin Primes

I haven't find any reason to use 'system("pause")'. However, its up to you. About bitwise sieve, bool takes 8 bits. So, when you assign something in prime, it will change all the 8 bits. You can use integer array, and imagine that each bit of the array maps an integer. Say a[2], a[0] maps to 0 to 31...
by Jan
Mon Jul 14, 2008 10:53 pm
Forum: Volume 4 (400-499)
Topic: 401 - Palindromes
Replies: 196
Views: 31623

Re: Palindromes 401 WA

Search the board first. Don't open a new thread if there is one already.
by Jan
Sun Jul 13, 2008 5:39 pm
Forum: Volume 103 (10300-10399)
Topic: 10391 - Compound Words
Replies: 40
Views: 17462

Re: 10391 - Compound Words

Use trie or hashing.
by Jan
Sun Jul 13, 2008 5:11 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 32521

Re: 10394 - Twin Primes

Use bitwise sieve and don't use 'system("pause");'.
by Jan
Fri Jul 11, 2008 8:44 pm
Forum: Volume 7 (700-799)
Topic: 703 - Triple Ties: The Organizer's Nightmare
Replies: 3
Views: 3687

Re: 703 - The Organizer's Nightmare

Increase the size of 'ans'. Say [50000][3].
by Jan
Thu Jul 10, 2008 9:05 pm
Forum: Volume 101 (10100-10199)
Topic: 10189 - Minesweeper
Replies: 418
Views: 67890

Re: 10189 - Minesweeper

You should print a blank line between cases, not after each case. ... int main() { ... int caseno=0; for(;;) { cin>>row>>col; if(row==0 && col==0) { break; } if(caseno++) cout<<endl; // I have added this line ... //cout<<endl; // Removed this line } return 0; } Hope it helps.
by Jan
Wed Jul 09, 2008 7:17 am
Forum: Volume 101 (10100-10199)
Topic: 10187 - From Dusk Till Dawn
Replies: 50
Views: 18124

Re: 10187 - From Dusk till Dawn

2nd part is the correct one.
by Jan
Wed Jul 09, 2008 7:11 am
Forum: Volume 101 (10100-10199)
Topic: 10189 - Minesweeper
Replies: 418
Views: 67890

Re: 10189 - Minesweeper

Your code prints a blank line before the first case. Remove it. Print a blank line between cases.

To sreejon, replace the following line

Code: Select all

while(scanf("%ld%ld",&n,&m)==2,n!=0,m!=0)
with

Code: Select all

while(scanf("%ld%ld",&n,&m)==2 && n!=0 && m!=0)
by Jan
Wed Jul 09, 2008 7:01 am
Forum: Volume 6 (600-699)
Topic: 629 - Test
Replies: 1
Views: 2908

Re: 629 - Test

Try the cases... Input: 3 -*- --- --- 3 -** --* --- 3 --- --- --- 4 ---- --** ---* ---- 9 ---*--*-- -----*--- ------*-- --------- -------*- --------* --------- --------- --------- 10 -********* --******** ---******* ----****** -----***** ------**** -------*** --------** ---------* ---------- 10 -***...
by Jan
Mon Jul 07, 2008 8:00 pm
Forum: Volume 104 (10400-10499)
Topic: 10450 - World Cup Noise
Replies: 42
Views: 20046

Re: 10450 - World Cup Noise

Just think that how many times the recursive calls being used? Say, for n = 6 you have to calculate for both 5 and 4, again for 5 you have to calculate both 4 and 3. 4 is calculated twice. So, if you think a while you will find that the number of calls are increasing exponentially.

Go to advanced search