|
|
| Show all threads Hide all threads Show all messages Hide all messages | | A subproblem | Igor Parfenov | 1670. Asterisk | 17 Aug 2026 13:38 | 1 | In my solution I had to solve following interesting subproblem. Given an array. There is somewhere a unique cutpoint in this array. We don't know where, but we can check, if x is a cutpoint in O(1). We have to find this cutpoint, split array in two parts and do the same recursively on both parts. We need to do it faster than in O(n^2). Solution: For a segment (l, r) check for cutpoints in following order: l, r, l+1, r-1, l+2, r-2, ... | | How do you solve this problem? | Alex Tolstov (SPb SPU) | 1670. Asterisk | 23 Jul 2020 04:12 | 2 | Let's construct the resulting sequence from N to 1 by keeping merged segments in stack. What is the condition for merging two segments? They are touching by one of the sides (r_1+1=l_2 or r_2+1=l_1). The last part of the solution is trivial (make a tree of merges, ...). | | Nice problem | Alexander Kouprin | 1670. Asterisk | 1 Oct 2010 01:37 | 1 | | | WA7 | pperm | 1670. Asterisk | 15 Jan 2009 15:08 | 3 | WA7 pperm 14 Jan 2009 16:34 Give me plz some tests. Please only good permutation :) 4 1 4 2 3 This test help me) (1, (2,3) * (4)) = (1,4,2,3) Wa 7 again :) 9 3 2 1 7 9 8 4 5 6 ((1)*(2)*(3),(4,5,6)*(7,(8)*(9))) | | question about a specific test | momo | 1670. Asterisk | 14 Jan 2009 16:32 | 2 | For this input: 3 1 2 3 Is this output correct: (1,(2,3)) Why not? I think that it's correct. | | Invalid sequence in the example | Bruce Merry | 1670. Asterisk | 10 Jan 2009 15:50 | 2 | As an example of evaluating subexpression, (1, (2 * 3), 4) is shown. However, this is not a valid expression according to the grammar (* can only operate on sequences, not numbers). Which is correct? | | What do you mean by "..." in formal definition? | Ilya Porublyov | 1670. Asterisk | 10 Jan 2009 13:08 | 1 | What do you mean by "..." in formal definition? Is it the same as <expression> ::= <sequence>{*<sequence>} and <sequence> ::= (<sequence element>{,<sequence element>} or smth else? |
|
|
|