結果

問題 No.2217 Suffix+
ユーザー lddlinanlddlinan
提出日時 2023-03-06 13:03:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 960 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 85,048 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 05:09:22
合計ジャッジ時間 3,602 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 6 ms
4,348 KB
testcase_15 AC 6 ms
4,348 KB
testcase_16 AC 10 ms
4,348 KB
testcase_17 AC 8 ms
4,348 KB
testcase_18 AC 6 ms
4,348 KB
testcase_19 AC 39 ms
4,348 KB
testcase_20 AC 36 ms
4,348 KB
testcase_21 AC 9 ms
4,348 KB
testcase_22 AC 32 ms
4,348 KB
testcase_23 AC 36 ms
4,348 KB
testcase_24 AC 21 ms
4,348 KB
testcase_25 AC 21 ms
4,348 KB
testcase_26 AC 20 ms
4,348 KB
testcase_27 AC 21 ms
4,348 KB
testcase_28 AC 21 ms
4,348 KB
testcase_29 AC 88 ms
4,348 KB
testcase_30 AC 98 ms
4,348 KB
testcase_31 AC 99 ms
4,348 KB
testcase_32 AC 96 ms
4,348 KB
testcase_33 AC 95 ms
4,348 KB
testcase_34 AC 20 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 71 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;

bool rcmp(int a, int b) { return a>b; }
typedef long long LL;



LL as[100004];
int main() {
    int n, i, k;
    LL b, d, x, nb, s, c, j;
    scanf("%d %d", &n, &k);
    for (i=0; i<n; i++) scanf("%lld", &as[i]);
    b=0; d=2;
    for (i=0; i<14; i++) d*=10;
    x=d;
    while(d) {
        while(1) {
            nb=b+d; if (nb>x) break;
            s=0; c=0;
            for (i=0; i<n; i++) {
                if (as[i]+s>=nb) continue;
                j=(nb-as[i]-s+i)/(i+1);
                c+=j; s+=j*(i+1);
                if (c>k) break;
            }
            if (c>k) break;
            b=nb;
        }
        d>>=1;
    }
    printf("%lld\n", b);
    return 0;
}
0