4463: Wrong algorithm
内存限制:128 MB
时间限制:5 S
标准输入输出
题目类型:传统
评测方式:Special Judge
上传者:
提交:25
通过:11
题目描述
There is a question like this:
Enter a grid of n rows and m columns, and find a grid to maximize the sum of all the grids in the row and column. If the answer is not unique, output any solution.
For example, in the following example, the optimal solution is (1,3), that is, the intersection of the first row and the three columns (rows are numbered 1~n from top to bottom, and columns are numbered 1~m from left to right), and the sum of all seven numbers is 35.
Just before the match, a referee thought of such an algorithm:
First, find a row r (1 ≤ r ≤ n) to maximize the sum of all numbers in the row, then find a column c (1 ≤ c ≤ m) to maximize the sum of all numbers in the column, and finally directly output (r, c). If there are multiple r satisfying the condition, the minimum r is output. The same is true for c.
Obviously, this algorithm is wrong, but it has passed most of the test data! Can you find the "weak" data that makes the wrong algorithm get the correct result, so that the judges can improve the data?
Enter a grid of n rows and m columns, and find a grid to maximize the sum of all the grids in the row and column. If the answer is not unique, output any solution.
For example, in the following example, the optimal solution is (1,3), that is, the intersection of the first row and the three columns (rows are numbered 1~n from top to bottom, and columns are numbered 1~m from left to right), and the sum of all seven numbers is 35.
Just before the match, a referee thought of such an algorithm:
First, find a row r (1 ≤ r ≤ n) to maximize the sum of all numbers in the row, then find a column c (1 ≤ c ≤ m) to maximize the sum of all numbers in the column, and finally directly output (r, c). If there are multiple r satisfying the condition, the minimum r is output. The same is true for c.
Obviously, this algorithm is wrong, but it has passed most of the test data! Can you find the "weak" data that makes the wrong algorithm get the correct result, so that the judges can improve the data?
输入格式
The input contains no more than 100 sets of data. The first row of each group of data is two integers n, m (1 ≤ n ≤ 500, 1 ≤ m ≤ 500), that is, the number of rows and columns. Each of the following n lines contains m integers from 1 to 100.
输出格式
For each group of data, if the wrong algorithm can get the correct result, output "Weak", otherwise output "Strong".
输入样例 复制
4 4
5 5 5 5
1 1 5 1
1 1 5 1
1 1 5 1
5 4
2 5 1 1
1 1 9 1
1 1 1 1
1 1 1 1
1 1 1 1
输出样例 复制
Case 1: Weak
Case 2: Strong