結果

問題 No.180 美しいWhitespace (2)
ユーザー mayoko_mayoko_
提出日時 2015-04-05 23:58:13
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 80 ms / 5,000 ms
コード長 855 bytes
コンパイル時間 1,111 ms
コンパイル使用メモリ 143,916 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 04:48:33
合計ジャッジ時間 3,747 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 9 ms
4,376 KB
testcase_07 AC 15 ms
4,376 KB
testcase_08 AC 21 ms
4,376 KB
testcase_09 AC 76 ms
4,376 KB
testcase_10 AC 77 ms
4,376 KB
testcase_11 AC 78 ms
4,376 KB
testcase_12 AC 80 ms
4,376 KB
testcase_13 AC 80 ms
4,376 KB
testcase_14 AC 80 ms
4,380 KB
testcase_15 AC 80 ms
4,380 KB
testcase_16 AC 78 ms
4,380 KB
testcase_17 AC 80 ms
4,376 KB
testcase_18 AC 78 ms
4,376 KB
testcase_19 AC 77 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 80 ms
4,376 KB
testcase_31 AC 80 ms
4,376 KB
testcase_32 AC 77 ms
4,380 KB
testcase_33 AC 80 ms
4,376 KB
testcase_34 AC 80 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;

const int MAXN = 1020;
ll a[MAXN], b[MAXN];
int N;

ll get(ll x) {
    ll ret = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            ret = max(ret, abs((b[i]-b[j]) * x + (a[i]-a[j])));
        }
    }
    return ret;
}

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        scanf("%lld %lld", a+i, b+i);
    }
    ll low = 1, high = 1e9+7;
    while (high-low > 2) {
        ll m1 = (high+low*2) / 3;
        ll m2 = (high*2+low) / 3;
        if (get(m1) <= get(m2)) high = m2;
        else low = m1;
    }
    if (get(low) <= get(high-1)) cout << low << endl;
    else cout << high-1 << endl;
    return 0;
}
0