Guest User

Untitled

a guest
Jan 11th, 2016
2,299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define forn(i, n) for (int i = 0; i < int(n); i++)
  4. #define ford(i, n) for (int i = int(n) - 1; i >= 0; i--)
  5. #define fore(i, l, r) for (int i = int(l); i < int(r); i++)
  6. #define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m))
  7. #define all(a) (a).begin(), (a).end()
  8. #define sz(a) int((a).size())
  9. #define pb(a) push_back(a)
  10. #define mp(x, y) make_pair((x), (y))
  11. #define x first
  12. #define y second
  13.  
  14. using namespace std;
  15.  
  16. typedef long long li;
  17. typedef long double ld;
  18. typedef pair<int, int> pt;
  19.  
  20. template<typename X> inline X abs(const X& a) { return a < 0? -a: a; }
  21. template<typename X> inline X sqr(const X& a) { return a * a; }
  22.  
  23. const int INF = int(1e9);
  24. const li INF64 = li(1e18);
  25. const ld EPS = 1e-9, PI = 3.1415926535897932384626433832795;
  26.  
  27. const int N = 5050;
  28.  
  29. int n, m;
  30. int a[N][N];
  31.  
  32. inline bool read() {
  33.     if (!(cin >> n >> m)) return false;
  34.     forn(i, n) forn(j, m) assert(scanf("%d", &a[i][j]) == 1);
  35.     return true;
  36. }
  37.  
  38. inline void solve() {
  39.     int ans = INT_MIN;
  40.     forn(i, n) {
  41.         int cur = INT_MAX;
  42.         forn(j, m) cur = min(cur, a[i][j]);
  43.         ans = max(ans, cur);
  44.     }
  45.     cout << ans << endl;
  46. }
  47.  
  48. int main() {
  49. #ifdef SU1
  50.     assert(freopen("input.txt", "rt", stdin));
  51.     //assert(freopen("output.txt", "wt", stdout));
  52. #endif
  53.    
  54.     cout << setprecision(10) << fixed;
  55.     cerr << setprecision(5) << fixed;
  56.  
  57.     while (read()) {
  58.         solve();
  59.         //break;
  60.     }
  61.    
  62.     return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment