Logo
(追記) (追記ここまで)

11225번 - Primal Partitions 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB169969.231%

문제

The Math department has challenged the Computer Science department at your University to solve a difficult puzzle in Discrete Mathematics. With the pride of your Computer Science department at stake, you must solve this puzzle!

In this puzzle, you are given a sequence of n positive integers. The sequence must be partitioned into k consecutive contiguous regions, with at least 1 integer in each region. After finding a partition, it is scored in a strange way. In each region, you must find the largest prime number that divides every number in that region. The Math department reminds you a prime number is an integer greater than 1 where its only divisors are 1 and itself. If you cannot find such a prime, your score for that region is 0. Your total score for the partition is the minimum over all regions.

Your task is to find the maximum possible score. The Math department will win if their score is better, so be sure to find the maximum each time!

입력

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. Each input begins with a line with two space-separated integers n (1 ≤ n ≤ 20 000) and k (1 ≤ k ≤ min(100, n)), where n is the number of positive integers in the original sequence, and k is the number of regions in the partition. The next line contains n space-separated integers v (1 ≤ v ≤ 1 000 000). This is the sequence to be partitioned, in order.

출력

Output a single integer representing the maximum score possible partitioning the sequence of n positive integers into k regions.

제한

예제 입력 1

5 3
10 5 4 8 3

예제 출력 1

2

예제 입력 2

5 3
10 11 12 13 14

예제 출력 2

0

힌트

출처

University > North American Invitational Programming Contest > NAIPC 2015 E번

Contest > Open Cup > 2014/2015 Season > Stage 12: Grand Prix of America E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /