結果

問題 No.2157 崖
ユーザー hourenhouren
提出日時 2022-12-09 21:43:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 1,663 ms
コンパイル使用メモリ 172,012 KB
実行使用メモリ 18,432 KB
最終ジャッジ日時 2024-04-22 21:31:03
合計ジャッジ時間 7,325 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 WA -
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 412 ms
17,152 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 333 ms
15,360 KB
testcase_18 AC 326 ms
15,104 KB
testcase_19 WA -
testcase_20 AC 464 ms
18,432 KB
testcase_21 AC 463 ms
18,304 KB
testcase_22 AC 313 ms
14,464 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0