sdut2409 The Best Seat in ACM Contest

网友投稿 886 2022-08-31

sdut2409 The Best Seat in ACM Contest

sdut2409 	 The Best Seat in ACM Contest

The Best Seat in ACM Contest

Time Limit: 1000MS Memory limit: 65536K

题目描述

Cainiao is a university student who loves ACM contest very much. It is a festival for him once when he attends ACM Asia Regional Contest because he always can find some famous ACMers there. Cainiao attended Asia Regional Contest Fuzhou Site on November 20, 2011. After he got seat map, he wanted to know which seat is the best one. Cainiao have joined so many QQ Group about ACM/ICPC that he is almost familiar with the strength of each team. In his mind, the value of a seat is defined as following: 1. Strength of each team can be expressed as a positive integer. 2. The value of a seat is related to the adjacent seat (up/down/left/right, only four directions being considering). 3. For an adjacent seat, if the strength of this team is stronger than yours, the absolute value of difference of two teams should be added to your seat, otherwise, the absolute value of difference should be subtracted from your seat. 4. If the adjacent seat is empty (which means you are located at the most left/right/up/down), the value of your seat should be subtracted 1. 5. The best one in a contest is the seat that has the highest value. 6. The initial value of the seat is ZERO.

For example, there are 12 ( 3 X 4 ) teams in a contest, the strength of each team is as figure (a), and then you can calculate the value of each seat as figure (b).

输入

Input contain a positive integer T( T <=50 ) in the first line, which means T cases. The first line of each case contains two positive integers N and M (3 <= N, M <= 20) which means the row and column number of the teams, then N rows following, each line contains M positive integers that represent the strengths of the teams.

输出

For each case, first output the case number, and then output the value and row number and column number of the best seat in one line for each case.  If there are multiple solutions for one case, you should output the seat whose row number is largest and only output the seat whose column number is largest if still overlapping.

示例输入

13 41 5 3 46 3 3 44 3 2 1

示例输出

Case 1: 7 1 1

提示

来源

2012年"浪潮杯"山东省第三届ACM大学生程序设计竞赛

///发现这是能做的水题#include#include#include#define inf 99999999using namespace std;int dir[4][2] = {0,1,0,-1,-1,0,1,0};int map[22][22],tmap[22][22];int n,m;int main(){    int cas;    cin>>cas;    for(int l = 1; l <= cas; l++)    {//        memset(map,0,sizeof(map));//        memset(tmap,0,sizeof(tmap));        cin>>n>>m;        for(int i=0;i>map[i][j];            tmap[i][j]=0;        }        for(int i=0;i=0 && x=0&&y=0;i--)        {            for(int j=m-1;j>=0;j--)            {                if(tmap[i][j] > max)                {                    max = tmap[i][j];                    xx=i;                    yy= j;                }            }        }        printf("Case %d: %d %d %d\n",l,max,xx+1,yy+1);    }    return 0;}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:深入浅出Go语言的库源码文件(go语言开发文档)
下一篇:深度学习论文: You Only Look Twice: Rapid Multi-Scale Object Detection In Satellite Imagery及其PyTorch实现
相关文章

 发表评论

暂时没有评论,来抢沙发吧~