Hi,
Today at 13:00 UTC there will be a Warmup Round of Yandex.Algorithm 2017. This is a great possibility for you to get familiar with TCM/Time contest format, and also to pass to the elimination round of the competition by successfully submitting at least one problem.
In order to participate in the competition, you have to register, the registration will remain open for the next week.
The link to the round will appear on the site of the competition shortly before the start of the round.
Good luck!
Enter the contest!
UPD: Round is over, thanks for the participation! Congratulations to four participants who successfully solved all problems:
All participants with at least one successful submission pass to the elimination round of the competition.
UPD2: Contest editorial.
How to solve problem D?
I solved it with DP : DP[index][parity of previous element][parity of current element]. The main idea is you wouldn't use the operation twice on the same index.
Greedy — http://ideone.com/rhDW7F You do at-most 1 operation at each position. Fix operations on borders(4 cases), then starting from first position, do this greedy procedure — if any is of opposite parity, increment next 3. If last 2 are in order, update answer.
Thank you for this round!
Couple things I want to mention:
-DONLINE_JUDGE
to gcc — it's common practice that boilerplate code includes #ifdef to not include some headers at judgeI like short boring statements without story.
In problem C , What's wrong with first sorting the array and then doing a DP , where DP[i] = min(DP[i-1],DP[i-2]) + 1 . (DP[i-2] is only included when abs(arr[i] — arr[i-1]) <= 1 )
It should be abs(arr[i] — arr[i-1]) <= 2, can choose arr[i] — 1 and arr[i — 1] + 1.
Thanks. Is there anything else wrong with this approach ? I still get a WA on case 41.
I passed with this approach. maybe there is some minor bug in your program ? http://ideone.com/wW1ZsF
Thanks.
I got WA-41 too. Can anyone guess the type of test case?
Maybe something like:
10
1 2 2 2 2 3 3 3 3 4
ans = 5
Thanks, that helped
Not for me. :(
F = mincost?
Yep.