传统题 1000ms 256MiB

Easy

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Given a positive integer n n , consider an n×n n \times n matrix a a where the element in the i i -th row and j j -th column is given by ai,j=(i1)×n+j a_{i,j} = (i-1) \times n + j . Below is an example for n=4 n = 4 :

$ \begin{bmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \\ 9 & 10 & 11 & 12 \\ 13 & 14 & 15 & 16 \\ \end{bmatrix} $

Your task is to select some numbers from the matrix such that:

  • Exactly two numbers are chosen from each row.

  • Exactly two numbers are chosen from each column.

You need to determine the minimum sum of the numbers that are selected.

Input Format

The first line contains a positive integer n n , representing the size of the matrix.

2n1032 \leq n \leq 10^3

Output Format

A single integer, representing the minimum sum of the numbers that are selected.

Sample Input #1

2

Sample Output #1

10

Sample Input #2

4

Sample Output #2

68

2025XCPC集训队&&算法培训 — 综合训练(一)

未参加
状态
已结束
规则
ACM/ICPC
题目
5
开始于
2025-8-22 19:00
结束于
2025-8-22 22:00
持续时间
3 小时
主持人
参赛人数
21