Plus Matrix

AtCoder
IDarc115_b
Time2000ms
Memory256MB
Difficulty
Given is an $N \times N$ matrix $C$ whose elements are non-negative integers. Determine whether there is a pair of sequences of non-negative integers $A_1,A_2,\ldots,A_N$ and $B_1,B_2,\ldots,B_N$ such that $C_{i,j}=A_i+B_j$ for every $(i, j)$. If the answer is yes, print one such pair. ## Constraints * $1 \leq N \leq 500$ * $0 \leq C_{i,j} \leq 10^9$ ## Input Input is given from Standard Input in the following format: $N$ $C_{1,1}$ $C_{1,2}$ $\ldots$ $C_{1,N}$ $C_{2,1}$ $C_{2,2}$ $\ldots$ $C_{2,N}$ $:$ $C_{N,1}$ $C_{N,2}$ $\ldots$ $C_{N,N}$ [samples]
Samples
Input #1
3
4 3 5
2 1 3
3 2 4
Output #1
Yes
2 0 1
2 1 3

Note that $A$ and $B$ consist of non-negative integers.
Input #2
3
4 3 5
2 2 3
3 2 4
Output #2
No
API Response (JSON)
{
  "problem": {
    "name": "Plus Matrix",
    "description": {
      "content": "Given is an $N \\times N$ matrix $C$ whose elements are non-negative integers. Determine whether there is a pair of sequences of non-negative integers $A_1,A_2,\\ldots,A_N$ and $B_1,B_2,\\ldots,B_N$ such",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc115_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given is an $N \\times N$ matrix $C$ whose elements are non-negative integers. Determine whether there is a pair of sequences of non-negative integers $A_1,A_2,\\ldots,A_N$ and $B_1,B_2,\\ldots,B_N$ such...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments