17 lines
512 B
Python
17 lines
512 B
Python
import sys
|
|
|
|
if __name__ == '__main__':
|
|
perl_amount, color_kind_amount = map(int, input().split())
|
|
color_counts: list[tuple[int, int]] = []
|
|
for i in range(color_kind_amount):
|
|
color_counts.append((i, int(input())))
|
|
|
|
color_counts.sort(key=lambda x: x[1])
|
|
|
|
colors: list[int] = []
|
|
for i, color_count in color_counts:
|
|
colors += [i + 1] * color_count
|
|
print(colors, file=sys.stderr)
|
|
for i in range(perl_amount // 2):
|
|
print(colors[i], colors[i + perl_amount // 2])
|