P27302 [AtCoder] Non-triangular Triplets
提高
题目描述

Problem Description

Given positive integers \( N \) and \( K \).

Determine whether it is possible to divide \( 3N \) integers \( K, K+1, ..., K+3N-1 \) into \( N \) triplets \( (a_1, b_1, c_1), ..., (a_N, b_N, c_N) \) such that each integer from \( K, K+1, ..., K+3N-1 \) appears exactly once in one of the \( N \) triplets, and for all \( i \) from 1 to \( N \), \( a_i + b_i \leq c_i \) holds.

If possible, construct one such division.

Input Format

The input is given from the standard input in the following format:

\( N \) \( K \)

Output Format

If it is not possible to divide the \( N \) triplets satisfying the conditions, output -1. If possible, output \( N \) triplets in the following format:

\( a_1 \) \( b_1 \) \( c_1 \) \( : \) \( a_N \) \( b_N \) \( c_N \)

Sample Input and Output

Sample Input #1

1 1

Sample Output #1

1 2 3

Sample Input #2

3 3

Sample Output #2

-1

Notes/Hints

Constraints

  • \( 1 \leq N \leq 10^5 \)
  • \( 1 \leq K \leq 10^9 \)
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 1
样例输出
1 2 3