Non-triangular Triplets

AtCoder
IDnikkei2019_2_qual_e
Time2000ms
Memory256MB
Difficulty
Given are positive integers $N$ and $K$. Determine if the $3N$ integers $K, K+1, ..., K+3N-1$ can be partitioned into $N$ triples $(a_1,b_1,c_1), ..., (a_N,b_N,c_N)$ so that the condition below is satisfied. Any of the integers $K, K+1, ..., K+3N-1$ must appear in exactly one of those triples. * For every integer $i$ from $1$ to $N$, $a_i + b_i \leq c_i$ holds. If the answer is yes, construct one such partition. ## Constraints * $1 \leq N \leq 10^5$ * $1 \leq K \leq 10^9$ ## Input Input is given from Standard Input in the following format: $N$ $K$ [samples]
Samples
Input #1
1 1
Output #1
1 2 3
Input #2
3 3
Output #2
\-1
API Response (JSON)
{
  "problem": {
    "name": "Non-triangular Triplets",
    "description": {
      "content": "Given are positive integers $N$ and $K$. Determine if the $3N$ integers $K, K+1, ..., K+3N-1$ can be partitioned into $N$ triples $(a_1,b_1,c_1), ..., (a_N,b_N,c_N)$ so that the condition below is sat",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "nikkei2019_2_qual_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given are positive integers $N$ and $K$.\nDetermine if the $3N$ integers $K, K+1, ..., K+3N-1$ can be partitioned into $N$ triples $(a_1,b_1,c_1), ..., (a_N,b_N,c_N)$ so that the condition below is sat...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments