You are not logged in. Please login at to post your questions!


Help needed in LCM range query problem

Given an array A of N (N<=2*10^4) elements and Q(Q<=10^6) queries. Each array element A[i]<=60.

In each query you are given a number K (K<=N). Compute LCM for all subarrays of size K and report the smallest value of LCM found. Please suggest some approach for this problem.

asked 18 May, 23:06

lakh's gravatar image

accept rate: 23%

Please post the link of the question for which you ask for help. It makes for us easy to verify our approach, before answering the question.

(18 May, 23:49) sorb19974★

I tried storing precomputed results for subarrays of size<=sqrt(N) and for subarrays with size>sqrt(N), I used the brute force way but got TLE.

(18 May, 23:59) lakh4★

The tutorial for the problem. It is on right panel on codeforces under contest materials

(19 May, 05:27) fr4nkesti3n4★

I am looking for some other approach possible to solve this problem

(19 May, 08:29) lakh4★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 18 May, 23:06

question was seen: 112 times

last updated: 19 May, 08:29