Straight Path

AtCoder
IDarc189_e
Time2000ms
Memory256MB
Difficulty
Among the ways to label the edges of a complete graph $G$ with $N$ vertices with positive integers, a graph satisfying the following condition is called a "good complete graph". * There exists no path that visits all $N$ vertices exactly once and whose sequence of edge labels, in the order the edges are traversed, is non-decreasing. Determine whether a good complete graph exists. If it exists, construct one that minimizes the maximum label assigned to an edge. ## Constraints * $2 \leq N \leq 20$ ## Input The input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
5
Output #1
Yes
2 1 4 4
4 3 1
1 3
2

For example, consider the path that visits vertices in the order $2, 5, 1, 4, 3$. The sequence of edge labels traversed is $(1, 4, 4, 1)$, which is not non-decreasing.
Moreover, there is no path whose sequence of edge labels is non-decreasing, so this graph satisfies the condition.
Also, when $N=5$, it is impossible to assign labels so that the maximum label assigned to an edge is $3$ or less, so this output is valid.
Input #2
2
Output #2
No
API Response (JSON)
{
  "problem": {
    "name": "Straight Path",
    "description": {
      "content": "Among the ways to label the edges of a complete graph $G$ with $N$ vertices with positive integers, a graph satisfying the following condition is called a \"good complete graph\". *   There exists no p",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc189_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Among the ways to label the edges of a complete graph $G$ with $N$ vertices with positive integers, a graph satisfying the following condition is called a \"good complete graph\".\n\n*   There exists no p...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments