code_hard123's blog

By code_hard123, history, 8 years ago, In English

Given N points in two dimensional space and Q queries. In each query, given two non negative integers a , b. Find the point (x,y) such that F(x,y) is minimum, where F(x,y) = a * x + b * y

Constraints:
1 <= N <= 10^6
1 <= Q <= 10^5
0 <= a , b <= 10^9
0 <= |x| , |y| <= 10^9

Thank You!

Full text and comments »

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

By code_hard123, history, 8 years ago, In English

Given an array, and there are Q queries of two types.

Type-1 : given l , r , val

Update a[i] = a[i] xor val where i = [l , r]

Type-2 : given l , r

Return sum of a[i] where i = [l , r]

Can it be solved by segment tree with lazy propagation?

ThankYou :)

Full text and comments »

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

By code_hard123, history, 8 years ago, In English

Hi all,

My solution to problem http://mirror.codeforces.com/contest/688/problem/D

gave RuntimeError when i took array input before and then processed.

But the same code gave AC when I processed simultaenously while taking input.

I have no idea why the first code gave runtime error :(

RUNTIME ERROR CODE- http://mirror.codeforces.com/contest/688/submission/18818380

AC CODE — http://mirror.codeforces.com/contest/688/submission/18818424

Thank you :))

Full text and comments »

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

By code_hard123, history, 9 years ago, In English

Hi all ,

Is it possible to calculate the Nth (1 <= N <= 1e18) term of following quadratic recurrence using matrix exponentiation.

F(i) = a * F(i -1) * F(i -1) + b * F(i -1) + c , where a , b , c are non negative constants and F0 (Initial Term) is given.

Full text and comments »

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