B. Dinner with Emma

题目连接:

http://www.codeforces.com/contest/616/problem/A

Description

Jack decides to invite Emma out for a dinner. Jack is a modest student, he doesn't want to go to an expensive restaurant. Emma is a girl with high taste, she prefers elite places.

Munhattan consists of n streets and m avenues. There is exactly one restaurant on the intersection of each street and avenue. The streets are numbered with integers from 1 to n and the avenues are numbered with integers from 1 to m. The cost of dinner in the restaurant at the intersection of the i-th street and the j-th avenue is cij.

Jack and Emma decide to choose the restaurant in the following way. Firstly Emma chooses the street to dinner and then Jack chooses the avenue. Emma and Jack makes their choice optimally: Emma wants to maximize the cost of the dinner, Jack wants to minimize it. Emma takes into account that Jack wants to minimize the cost of the dinner. Find the cost of the dinner for the couple in love.

Input

The first line contains two integers n, m (1 ≤ n, m ≤ 100) — the number of streets and avenues in Munhattan.

Each of the next n lines contains m integers cij (1 ≤ cij ≤ 109) — the cost of the dinner in the restaurant on the intersection of the i-th street and the j-th avenue.

Output

Print the only integer a — the cost of the dinner for Jack and Emma.

Sample Input

3 4

4 1 3 5

2 2 2 2

5 4 5 1

Sample Output

2

Hint

题意

给你n行m列,A负责选行,B负责选列,A先选

A希望选择出来的数尽量大,B希望选择出来的数尽量小

问最后答案应该是多少

题解:

输出比较每一行的最小值,然后输出最大的就好了

因为A先选,所以肯定会选择某一行中,最小值最大的那个

B肯定选择这一行的最小值

代码

#include<bits/stdc++.h>
using namespace std; int Ans = 0;
int main()
{
int n,m;
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
{
int T = 1e9;
for(int j=0;j<m;j++)
{
int x;scanf("%d",&x);
T = min(x,T);
}
Ans = max(T,Ans);
}
printf("%d\n",Ans);
}

Codeforces Educational Codeforces Round 5 B. Dinner with Emma 暴力的更多相关文章

  1. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  2. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

  3. codeforces Educational Codeforces Round 5 A. Comparing Two Long Integers

    题目链接:http://codeforces.com/problemset/problem/616/A 题目意思:顾名思义,就是比较两个长度不超过 1e6 的字符串的大小 模拟即可.提供两个版本,数组 ...

  4. codeforces Educational Codeforces Round 16-E(DP)

    题目链接:http://codeforces.com/contest/710/problem/E 题意:开始文本为空,可以选择话费时间x输入或删除一个字符,也可以选择复制并粘贴一串字符(即长度变为两倍 ...

  5. Codeforces Educational Codeforces Round 15 E - Analysis of Pathes in Functional Graph

    E. Analysis of Pathes in Functional Graph time limit per test 2 seconds memory limit per test 512 me ...

  6. Codeforces Educational Codeforces Round 15 D. Road to Post Office

    D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standa ...

  7. Codeforces Educational Codeforces Round 15 C. Cellular Network

    C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  8. Codeforces Educational Codeforces Round 5 E. Sum of Remainders 数学

    E. Sum of Remainders 题目连接: http://www.codeforces.com/contest/616/problem/E Description The only line ...

  9. Codeforces Educational Codeforces Round 5 D. Longest k-Good Segment 尺取法

    D. Longest k-Good Segment 题目连接: http://www.codeforces.com/contest/616/problem/D Description The arra ...

随机推荐

  1. DzzOffice结合office web Apps私有部署的实例

    很多朋友都想在自己使用的DzzOffice中,调用本地部署的office web Apps server. 下面我就直接从头到尾的将部署全部过程分享给大家. 准备条件:两台服务器,配置稍高点,以免卡顿 ...

  2. Raspberry Pi3 ~ Eclipse中添加wiringPi 库函数

    这篇是在博客园原创 转载注明出处啊 以前用单片机.STM32之类的时候都是在一个集成的开发环境下进行的 比如Keil.IAR等 那么linux下编程,eclipse是个不错的选择 关于树莓派的GPIO ...

  3. strtol()函数

    #include <stdlib.h>#include <stdio.h> int main(){ char a[] = "100"; char b[] = ...

  4. 使用Java进行MD5加密

    使用Java自带的MessageDigest类可以轻松实现MD5加密,只不过加密后得到的是byte数组,我们需要将其转换为16进制的字符. 代码如下: package com.stepsoft.tes ...

  5. Masonry 实现输入框随键盘位置改变

    Github: https://github.com/saitjr/MasonryDemo 直接上代码: #import "ViewController4.h" #import & ...

  6. 关于在 mac上配置pytesseract的相关问题

    因为踩了两个小时坑 特别是在配置依赖tesseract-ORC识别库时候的问题 特别麻烦 一定要用brewhome 一定要用brewhome 一定要用brewhome 重要的事情说三遍. 刚开始我在网 ...

  7. iconfont阿里妈妈前端小图标使用方法详解

    图标选购网址:http://www.iconfont.cn/ 1.从阿里妈妈网站选购好小图标,加入购物车,下载好文件: 2.把字体文件放入字体(font)文件夹(tff)(woff),(eot) 3. ...

  8. 可迭代的集合类型使用foreach语句

    在学习算法这本书图论那一部分的时候,接触到了几个类似for(int w:G.adj(v)),的语句,不是很理解,就去百度,发现这是一种叫做foreach的语法,在书的76页有讲到,但是之前没认真看书, ...

  9. devexpress皮肤设置

    DEV的皮肤管理控件:SkinController: TdxSkinController; 皮肤设置:SkinController.SkinName := appInfo.SkinName; TdxR ...

  10. 服务器之间建立oracle之间的关联语句

    create public database link DBLINK_WZGTAMS CONNECT TO WZGTAMS identified by WZGTAMS using ' (DESCRIP ...