### affix's blog

By affix, 7 years ago,

we define function f(i,j) on array A as below:

f(i,j) = (i-j)^2 + (A[i+1] + A[i+2] + A[i+3] + ... + A[j])^2

find the minimum value of function f.

2 <= A.size <= 10^5

-10^4 <= A[i] <= 10^4

• +3

By affix, 8 years ago,

We've got n nonnegative numbers (a[i]) . We want to find the pair with maximum gcd. For example if we have:

2 4 5 15

gcd(2,4)=2

gcd(2,5)=1

gcd(2,15)=1

gcd(4,5)=1

gcd(4,15)=1

gcd(5,15)=5

n<100,000 and a[i]<100,000

I have an O(n*sqrt(n)) algorithm is there more efficient algorithm like O(n*logn) or O(n)?

• +4

By affix, 8 years ago,

We've got n nonnegative numbers (a[i]) . We want to find the pair with maximum gcd. For example if we have:

2 4 5 15

gcd(2,4)=2

gcd(2,5)=1

gcd(2,15)=1

gcd(4,5)=1

gcd(4,15)=1

gcd(5,15)=5

n<100,000 and a[i]<100,000

I have an O(n*sqrt(n)) algorithm is there more efficient algorithm like O(n*logn) or O(n)?

• +7

By affix, 10 years ago,

Hi. I need an Implementation of Fenwick tree in C++ that can support lazy propagation. Can you help me?

• -2

By affix, 10 years ago,
Hi.
there is such a simple & cool game "flood it!".
i wonder is there any optimal algorithm that could discover what are the best choices in the game to finish it in minimum step?
if you just play once you could understand the rules of the game.

• +21

By affix, 10 years ago,
Hi.
please give negative vote to this blog to make it WORST BLOG EVER....

• -35

By affix, 10 years ago,

Hi everyone!

Here are two contest calendar.
I hope they'll be useful....

• -25

By affix, 10 years ago,
Hi everyone.
i was accepting some easy problems and reading peoples code in solution size order.
and in most problems C++ was not best language and vice versa when i was reading solutions in harder problems C++ was  better than other languages in solution size.
which language is winner?

• -9

By affix, 10 years ago,
Hi people!
recently i've learned about Dvorak keyboard and i want to use it but i think it would not easy to work with Dvorak after using QWERTY long time!
do you think really Dvorak is better for programming than QWERTY?