303165: CF616B. Dinner with Emma

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Dinner with Emma

题意翻译

杰克决定邀请艾玛出去吃饭。杰克是个谦虚的学生,他不想去昂贵的餐馆。可艾玛是个品味很高的女孩,她更喜欢高端的餐馆。 Munhatan由 $n$ 条街道和 $m$ 条巷子组成。在每一条街道和小巷的交叉口都有一家餐馆。街道用 $1$ 到 $n$ 的整数来编号,巷子用从 $1$ 到 $m$ 的整数来编号。在第 $i$ 街和第 $j$ 巷交叉口的餐馆里吃饭的费用是 $C_{i,j}$。 杰克和艾玛决定按以下方式选择餐馆。先是艾玛选了在哪条街上吃饭,然后杰克选了巷子。艾玛和杰克做出了最佳的选择:艾玛想最大限度地提高晚餐的成本,杰克想把它降到最低。而艾玛知道杰克的想法。告诉这对恋人晚餐最终的费用。 Translated by @[clock钟0622](https://www.luogu.com.cn/user/323183)

题目描述

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 $ c_{ij} $ . 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.

输入输出格式

输入格式


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 $ c_{ij} $ ( $ 1<=c_{ij}<=10^{9} $ ) — the cost of the dinner in the restaurant on the intersection of the $ i $ -th street and the $ j $ -th avenue.

输出格式


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

输入输出样例

输入样例 #1

3 4
4 1 3 5
2 2 2 2
5 4 5 1

输出样例 #1

2

输入样例 #2

3 3
1 2 3
2 3 1
3 1 2

输出样例 #2

1

说明

In the first example if Emma chooses the first or the third streets Jack can choose an avenue with the cost of the dinner $ 1 $ . So she chooses the second street and Jack chooses any avenue. The cost of the dinner is $ 2 $ . In the second example regardless of Emma's choice Jack can choose a restaurant with the cost of the dinner $ 1 $ .

Input

题意翻译

杰克决定邀请艾玛出去吃饭。杰克是个谦虚的学生,他不想去昂贵的餐馆。可艾玛是个品味很高的女孩,她更喜欢高端的餐馆。 Munhatan由 $n$ 条街道和 $m$ 条巷子组成。在每一条街道和小巷的交叉口都有一家餐馆。街道用 $1$ 到 $n$ 的整数来编号,巷子用从 $1$ 到 $m$ 的整数来编号。在第 $i$ 街和第 $j$ 巷交叉口的餐馆里吃饭的费用是 $C_{i,j}$。 杰克和艾玛决定按以下方式选择餐馆。先是艾玛选了在哪条街上吃饭,然后杰克选了巷子。艾玛和杰克做出了最佳的选择:艾玛想最大限度地提高晚餐的成本,杰克想把它降到最低。而艾玛知道杰克的想法。告诉这对恋人晚餐最终的费用。 Translated by @[clock钟0622](https://www.luogu.com.cn/user/323183)

加入题单

算法标签: