Four TSP

AtCoder
IDarc212_a
Time2000ms
Memory256MB
Difficulty
There is a complete graph with four vertices numbered $1, 2, 3, 4$. You will now assign weights to each of the six edges. Each weight should be a positive integer, and the sum of the six weights should be exactly $K$. More formally, you choose positive integers $x_{i,j} \ (1\leq i<j\leq 4)$ such that $\sum_{1\leq i<j\leq 4}x_{i,j}=K$, and assign weight $x_{i,j}$ to the edge connecting $i$ and $j$. For this weighted graph $G$, let $f(G)$ be the minimum sum of edge weights in a cycle that **passes through all vertices**. Find the sum, modulo $998244353$, of $f(G)$ over all possible $G$. What is a complete graph?A complete graph is a graph with an edge between every pair of two distinct vertices. ## Constraints * $6 \le K \le 5000$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $K$ [samples]
Samples
Input #1
7
Output #1
24

The possible graphs are the ones where one of the six edges has weight $2$ and the other edges have weight $1$. There are six such graphs $G$, and we have $f(G)=4$ for each of them, so the answer is $24$.
Input #2
2026
Output #2
513760748
API Response (JSON)
{
  "problem": {
    "name": "Four TSP",
    "description": {
      "content": "There is a complete graph with four vertices numbered $1, 2, 3, 4$. You will now assign weights to each of the six edges. Each weight should be a positive integer, and the sum of the six weights shoul",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc212_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "There is a complete graph with four vertices numbered $1, 2, 3, 4$.\nYou will now assign weights to each of the six edges. Each weight should be a positive integer, and the sum of the six weights shoul...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments