013's blog

By 013, history, 9 years ago, In English

Given an expression E and another integer 'k' , you are required to find out whether it is possible to parenthesize E such that it evaluates to 'k'. If the answer is YES, print the corresponding parenthesized expression. Assume the max and min value of E will be within -N and +N where N ≤ 10000 and the value of  - N ≤ k ≤ N.

Sample Input and output:

Input: E = 2 + 3 * ( - 1) + 4 + ( - 7), k = 8

Output: Yes. E = (2 + 3) * (( - 1) + 4) + ( - 7) = 8

Can this problem be solved in O(n2N)? If yes then how? If no then what is the best complexity to solve it?

Full text and comments »

  • Vote: I like it
  • +15
  • Vote: I do not like it

By 013, history, 9 years ago, In English

Here it is written that Dinic's algorithm can run in O(min{V3 / 2, E1 / 2}E) time for graphs with unit capacity edges. Do I need to modify dinic's code in order to achieve that time bound? If yes can anyone give me an example code.

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By 013, 9 years ago, In English

Help plz. Why is this submission getting wrong answer on test 19?

Thanks in advance :)

problem link

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it