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

# | User | Rating |
---|---|---|

1 | tourist | 3707 |

2 | Benq | 3672 |

3 | ksun48 | 3575 |

4 | Radewoosh | 3562 |

5 | Miracle03 | 3480 |

6 | maroonrk | 3406 |

7 | ecnerwala | 3400 |

8 | peehs_moorhsum | 3384 |

9 | sunset | 3338 |

10 | Um_nik | 3320 |

# | User | Contrib. |
---|---|---|

1 | 1-gon | 208 |

2 | Um_nik | 197 |

3 | YouKn0wWho | 192 |

4 | Errichto | 182 |

5 | sus | 181 |

6 | awoo | 180 |

7 | tourist | 175 |

8 | -is-this-fft- | 171 |

8 | SecondThread | 171 |

10 | Ashishgup | 170 |

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

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)?

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)?

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.

Hi.

please give negative vote to this blog to make it WORST BLOG EVER....

Hi everyone!

Here are two contest calendar.

I hope they'll be useful....

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?

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.

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/25/2021 19:01:05 (i2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|