結果
| 問題 |
No.2157 崖
|
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2022-12-09 21:43:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,042 bytes |
| コンパイル時間 | 1,965 ms |
| コンパイル使用メモリ | 176,020 KB |
| 実行使用メモリ | 18,176 KB |
| 最終ジャッジ日時 | 2024-10-14 21:20:39 |
| 合計ジャッジ時間 | 8,415 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define fix(x) fixed << setprecision(x)
#define asc(x) x, vector<x>, greater<x>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL <<62);
constexpr int INF = (1<<30);
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,m;
cin >> n >> m;
vector<vector<int>> a(n,vector<int>(m));
rep(i,n){
rep(j,m) cin >> a[i][j];
sort(all(a[i]));
a[i].push_back(INF);
}
int ans = INF;
rep(i,m){
int upd = 0, now = a[0][i];
for(int j=1;j<n;j++){
int x = *lower_bound(all(a[j]), now);
chmax(upd, x-now);
now = x;
}
if(now!=INF) chmin(ans, upd);
}
if(ans==INF) ans = -1;
cout << ans << '\n';
return 0;
}
houren