nhphuc's blog

By nhphuc, history, 2 hours ago, In English

Statement (in Vietnamese) and submission link: https://oj.vnoi.info/problem/tst25_bai2.

Summary: Given an integer $$$N$$$ and an array $$$A$$$ of $$$N$$$ elements. Initially, $$$\forall 1\leq i\leq N:\ A_i = 1$$$. You need to perform some operations (possibly none) to make all $$$A_i = i^i$$$. There are two types of operations:

  • $$$+\ i\ j\ k$$$: make $$$a_k\leftarrow a_i + a_j$$$.
  • $$$*\ i\ j\ k$$$: make $$$a_k\leftarrow a_i\cdot a_j$$$.

To pass the test, your total number of operations (let's call it $$$Q$$$) must satisfy $$$Q\leq 5\cdot N$$$. Otherwise, you will receive points according to the following formula:

  • If $$$Q \gt 20\cdot N$$$, you receive $$$0$$$ points.
  • Otherwise, you receive $$$0.9^{Q - 4}$$$ points (on a scale of $$$1$$$).

I already have a solution using binary exponentiation, but it only scores 30/100 (code: https://ideone.com/SBgtEt). Please help me. Thanks for your attention!

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