PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHBAHAI0000005. In k phần tử đầu (Print the First k Elements)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
In k phần tử đầu (Print the First k Elements)
Print the First k Elements
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
You are given an integer array of length , indexed from to , and an integer satisfying . Print exactly the first elements, at indices .
Input
- The first line contains two integers and .
- The second line contains exactly integers .
Output
Print on one line, separated by spaces.
Subtasks
Subtask 1 (20 points): , , .
Subtask 2 (30 points): , , .
Subtask 3 (50 points): , .
Examples
Input
6 4
3 1 4 1 5 9
Output
3 1 4 1
Explanation
Here and . The first four indices are , so the selected values are .