CF509D Restoring Numbers

题目描述

给你一个n*m的矩阵v。 v[i][j]=(a[i]+b[j])%k; 求a,b数组及其模数k。

输入格式

第一行两个整数n,m。 接下来n行,每行m个数。

输出格式

如果a,b,k存在输出“YES”,并依次输出模数k和数组a,b;否则输出“NO”。

说明/提示

By ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF509D/7ac883f4b0ad59dd2958c11fa8895789cce22db4.png) we denote the remainder of integer division of $ b $ by $ c $ . It is guaranteed that if there exists some set of numbers $ k,a_{1},...,a_{n},b_{1},...,b_{m} $ , that you could use to make matrix $ w $ , then there also exists a set of numbers that meets the limits $ 1