結果

問題 No.1715 Dinner 2
ユーザー ktr216ktr216
提出日時 2021-10-22 22:16:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 892 bytes
コンパイル時間 1,554 ms
コンパイル使用メモリ 169,800 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 13:29:43
合計ジャッジ時間 2,601 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;

typedef long long ll;

int main() {
    ll N, D;
    cin >> N >> D;
    vector<ll> P(N), Q(N);
    rep(i, 0, N) cin >> P[i] >> Q[i];
    ll ans = -1e18;
    rep(i, 0, N) {
        rep(j, 0, N) {
            if (i == j) continue;
            ll x = - P[i] + Q[i] - P[j] + Q[j];
            if (x >= 0) {
                ans = max(ans, min({0LL, - P[i], - P[i] + Q[i] - P[j]}));
            } else {
                if (D % 2) {
                    ll y = x * (D / 2 - 1) - P[i] + Q[i];
                    ans = max(ans, min({0LL, y - P[j], y - P[j] + Q[j] - P[i]}));
                } else {
                    ll y = x * (D / 2 - 1);
                    ans = max(ans, min({0LL, y - P[i], y - P[i] + Q[i] - P[j]}));
                }
            }
        }
    }
    cout << ans << endl;
}
0