affix's blog

By affix, 7 years ago, In English

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

Read more »

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

By affix, 8 years ago, In English

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

The answer is 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)?

Read more »

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

By affix, 8 years ago, In English

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

The answer is 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)?

Read more »

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

By affix, 10 years ago, In English

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

Read more »

 
 
 
 
  • Vote: I like it
  • -2
  • Vote: I do not like it

By affix, 10 years ago, In English
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.

Read more »

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

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

Read more »

 
 
 
 
  • Vote: I like it
  • -35
  • Vote: I do not like it

By affix, 10 years ago, In English

Hi everyone!

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

Read more »

 
 
 
 
  • Vote: I like it
  • -25
  • Vote: I do not like it

By affix, 10 years ago, In English
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.
what do you think about this?
which language is winner?

Read more »

 
 
 
 
  • Vote: I like it
  • -9
  • Vote: I do not like it

By affix, 10 years ago, In English
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?
please share your ideas & experience about this.

Read more »

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