結果

問題 No.2890 Chiffon
ユーザー 👑 seekworserseekworser
提出日時 2024-07-02 19:39:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 866 bytes
コンパイル時間 2,880 ms
コンパイル使用メモリ 249,384 KB
実行使用メモリ 13,344 KB
最終ジャッジ日時 2024-07-06 11:13:07
合計ジャッジ時間 8,045 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
11,648 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 133 ms
11,008 KB
testcase_23 AC 11 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 20 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 3 ms
5,376 KB
testcase_30 AC 3 ms
5,376 KB
testcase_31 AC 15 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 54 ms
6,528 KB
testcase_34 AC 53 ms
6,400 KB
testcase_35 AC 53 ms
6,400 KB
testcase_36 AC 52 ms
6,528 KB
testcase_37 AC 54 ms
6,400 KB
testcase_38 AC 52 ms
6,400 KB
testcase_39 AC 54 ms
6,400 KB
testcase_40 AC 53 ms
6,528 KB
testcase_41 AC 53 ms
6,528 KB
testcase_42 AC 54 ms
6,528 KB
testcase_43 TLE -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 想定TLE解法
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll n,k; cin >> n >> k;
    vector<ll> a(k+1);
    for (size_t i=0; i<k; i++) cin >> a[i];
    a[k] = a[0] + 2*n;

    vector<ll> an = a;
    for (size_t i=0; i<=k; i++) an[i] -= a[0];
    ll ans = 0;
    for (ll s = an[0]+1; s < an[1]; s++) {
        ll ok = 0, ng = n;
        auto is_ok = [&] (ll mid) -> bool {
            ll x = 2 * mid;
            ll t = s;
            for (size_t i=0; i<k-1; i++) {
                if (t + x >= an[i+2]) return false;
                t = max(t+x, an[i+1]+1);
            }
            return t+x <= s+2*n;
        };
        while (ng - ok > 1) {
            ll mid = (ok + ng) / 2;
            if (is_ok(mid)) ok = mid;
            else ng = mid;
        }
        ans = max(ans, 2*ok);
    }
    cout << ans << endl;
}
0