Комментарии
На KANCodeforces Round 1069, 4 месяца назад
0

i just observed that a number is useful only on the first time it appears. e.g. [2,1,5,2] can be compressed to [{2,1},{1,2},{5,3}]. reduces nk^2 to k^3. then a later number that is smaller is surely worse so reduce it to [{2,1},{5,3}]. "sub k^3" solution passes. the second number is the index

На bestial-42-centroidsCodeforces Round #1039 — Editorial, 9 месяцев назад
+23

wow instant tutorial!

На szilbCodeforces Round 1030 (Div. 2) Editorial, 10 месяцев назад
0

It will overflow and get junk values

На awooEducational Codeforces Round 174 [Rated for Div. 2], 14 месяцев назад
+1

You can check that the array must be in the form 1...3 where "..." represent one or more 2s.

Number of subsequences would for that form would be 2^n — 1, as any number of 2s (except 0) work. But checking all 1s and 3s (say using a prefix count array) would be O(N^2).

O(N) solution would be to count number of 1s so far, i.e. cnt1++. when you encounter 2, double curr and add cnt1. This works similar to the 2^n analysis count above. When encounter 3, you close the subsequence by adding curr to ans.

Remember to mod for each operation

На MisukiCodeforces Round 967 (Div. 2), 20 месяцев назад
0

hey you are the iq guy

На liaoyanxucheating?, 20 месяцев назад
0

grrrrr

На HushpuppyMean rating by country, 22 месяца назад
0

Auto comment: topic has been updated by Hushpuppy (previous revision, new revision, compare).

На Bazoka13Codeforces Round #947 (Div. 1 + Div. 2), 23 месяца назад
0

me too