All Tracks Problem

Beautiful Array
Tag(s):

Mathematics, Medium

Problem
Editorial
Analytics

Kevin thinks that array A is beautiful if

  • It contains N positive integers.
  • It doesn't contain any bad numbers.
  • There doesn't exist any number x and tuple (y1, y2, ..., yK) such that Ax = Ay1 · Ay2 · ... · AyK (yi < x).

Kevin knows M bad numbers Bi. Kevin also knows that 1 isn't a bad number. Now he wants to find lexicographically smallest beautiful array.

Input format:

The first line of the input contains three numbers N, K, M. The next line contains M integers - Bi.

Output format:

Output N integers - lexicographically smallest beautiful array.

Constraints:

  • 2 ≤ N, K ≤ 2 · 104
  • 0 ≤ M ≤ 2 · 104
  • 0 ≤ Bi ≤ 109
  • N, M, K ≤ 100 in test data worth 20% of all points
  • M = 0 in test data worth 20% of all points
SAMPLE INPUT
7 2 3
4 7 47
SAMPLE OUTPUT
1 2 3 5 8 11 12
Time Limit: 2,0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

IndiaHacks: Algorithms Qualifiers Round 2

OTHER PROBLEMS OF THIS CHALLENGE
Уведомления
View All Notifications

?