May be you don't like backtracking or you are very good in DP. But your statement is not correct. I got ACCEPTED using backtrack and it took .008 sec.CodeMaker wrote: This is a DP (Dynamic Programming) problem. Backtrack will give u nothing but TLE.

## Search found 17 matches

- Fri Dec 01, 2006 2:38 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10364 - Square
- Replies:
**47** - Views:
**14653**

- Sat Oct 14, 2006 1:19 am
- Forum: Volume 103 (10300-10399)
- Topic: 10336 - Rank the Languages
- Replies:
**21** - Views:
**9323**

I've given up this problem months ago, until I tried to solve it again today, and I get Accepted after experimenting with a lot of submission the max row and column never exceed 15, hope this could help anyone out there that still got time limit or memory limit in this problem bye Thanks for sharin...

- Tue Oct 10, 2006 9:23 am
- Forum: Volume 101 (10100-10199)
- Topic: 10139 - Factovisors
- Replies:
**80** - Views:
**26346**

- Wed Oct 04, 2006 9:08 pm
- Forum: Volume 3 (300-399)
- Topic: 333 - Recognizing Good ISBNs
- Replies:
**166** - Views:
**21055**

### Re: 333 - PE - but why?

Here's my code that gives presentation error with oj.... is it because of the endl on seeing eof?? I think you have printed the trailing spaces of the input string and getting PE. In general,the leading and trailing spaces must be deleted when print the input string as output. Warning: No,spaces in...

- Thu Sep 28, 2006 11:13 am
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies:
**36** - Views:
**17986**

### Help me

I got 3 seconds with read(0, buf, 1024*1024) and a linear-time algorithm. It also helps not to store the numbers that you read. Read them one at a time and throw them away immediately. Can anyone send the code segment where this read() function has been used and the data has been processed?? Please...

- Tue Sep 19, 2006 10:16 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies:
**36** - Views:
**17986**

I got 3 seconds with read(0, buf, 1024*1024) and a linear-time algorithm. It also helps not to store the numbers that you read. Read them one at a time and throw them away immediately. I tried to use this function read(). The judge replied me CE with the following message- Here are the compiler err...

- Sun Sep 17, 2006 9:51 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies:
**36** - Views:
**17986**

Yes, I use 3 flag, but in this way: Let program works for case #X(from 1 to 100); Than I use f1=2*X flag for elements which are not unique, f2=2*X-1 flag for elements which are unique yet, and f0<2*X-1 for elements which are not exist yet. So in the next test case all my 2*X and 2*X-1 flags becomes...

- Sun Sep 17, 2006 9:16 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10990 - Another New Function
- Replies:
**32** - Views:
**15183**

### Use backtracking to generate all unique prime factorization

got AC in 1.822. how to reduce it? i did: modified sieve ran upto 2000000 then recursion to get depth[] then O(1) output Mahbub I have generated all prime factorization and generated value for the phi(n) at the same time. You can get the prime factorization and number of relative primes of all numb...

- Sat Sep 16, 2006 10:38 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies:
**36** - Views:
**17986**

I don't need initialize it with 0's, because I use different flags for each test case, i. e. I use flags 1 and 2 for test case 1, 3 and 4 for test case 2 and so... I changed char[20000005] to unsigned char[20000005] but got WA again :( In my implementation, at the end of each test case i have reset...

- Fri Sep 15, 2006 12:26 am
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies:
**36** - Views:
**17986**

- Fri Sep 15, 2006 12:03 am
- Forum: Volume 110 (11000-11099)
- Topic: 11086 - Composite Prime
- Replies:
**33** - Views:
**17570**

### Re: I rather thank the problem setter.

If the problem is simple & specific, then where is our challenges? So, you think a problem which is !(specific & simple),that is challenging? !(specific & simple) = (!specific) || (!simple) Ok, i am giving you a simple and (!specific) problem- #Find A+B where A>10 && B>10 (It's not typing mistake i...

- Sun Sep 10, 2006 8:01 am
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies:
**36** - Views:
**17986**

why n lg n algo get TLE > 10 s ? since T < 100 and n < 100001 ? thanks Your program's worst case complexity = T*nlgn*C = 100*(lg100000)*100000*C=1.7*10^8*C,where C is cost of unit operation in each iteration. If this C is larger then there is no way of running within the time limit. I think this pr...

- Sun Sep 10, 2006 7:41 am
- Forum: Volume 110 (11000-11099)
- Topic: 11086 - Composite Prime
- Replies:
**33** - Views:
**17570**

### 11086 - Composite Prime

After long time i got a number theory problem with such an undefined statement like "N integers are positive-natural numbers". What does natural number means? Shall we try upto INFINITY?? Would you please tell me what would be the trouble if you had specified it with specific number. By the way i go...

- Thu Aug 31, 2006 7:22 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10129 - Play on Words
- Replies:
**34** - Views:
**10021**

### Re: 10129 ( plz give me some critical i\o)

Try This:tuman wrote:I badly need some input-output for the problem PLAY on WORDS its a simple Euler path problem but i cant do anything unless i experience some critical input and output.

Input:

2

4

ad

da

pq

qp

4

ad

da

ad

da

Output:

The door cannot be opened.

Ordering is possible.

- Tue Aug 15, 2006 8:31 am
- Forum: Volume 110 (11000-11099)
- Topic: 11073 - Euler's Totient Function
- Replies:
**20** - Views:
**6618**

### Take it easy

can someone post the paper that is to be read or how should one go about solving this problem. i have tried it but am out of ideas. All i know i could find from observations is that the odd solutions lie between n+1 and 4*n (maybe wrong). But for 10^9 it is too long. I didn't considered any number ...