PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000093. Tìm cặp chỉ số có BCNN nhỏ nhất (Minimum Possible LCM)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tìm cặp chỉ số có BCNN nhỏ nhất (Minimum Possible LCM)
Minimum Possible LCM
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given an array of positive integers indexed from through , find two distinct indices such that and is as small as possible among all index pairs. If more than one pair is optimal, print any valid optimal pair.
Input
The first line contains . The second line contains integers .
Output
Print two indices with forming an optimal pair.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
5
2 4 8 3 6
Output
1 2
Explanation
Indices and contain and , whose LCM is . No other pair of distinct indices yields a smaller LCM, so 1 2 is a valid output.