結果

問題 No.2217 Suffix+
ユーザー ripityripity
提出日時 2023-02-17 21:36:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 3,117 ms
コンパイル使用メモリ 214,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 18:46:44
合計ジャッジ時間 6,998 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 34 ms
4,380 KB
testcase_15 AC 34 ms
4,380 KB
testcase_16 AC 73 ms
4,376 KB
testcase_17 AC 51 ms
4,380 KB
testcase_18 AC 42 ms
4,380 KB
testcase_19 AC 101 ms
4,380 KB
testcase_20 AC 87 ms
4,376 KB
testcase_21 AC 14 ms
4,380 KB
testcase_22 AC 95 ms
4,380 KB
testcase_23 AC 71 ms
4,380 KB
testcase_24 AC 131 ms
4,380 KB
testcase_25 AC 130 ms
4,384 KB
testcase_26 AC 130 ms
4,376 KB
testcase_27 AC 130 ms
4,380 KB
testcase_28 AC 130 ms
4,380 KB
testcase_29 AC 130 ms
4,376 KB
testcase_30 AC 130 ms
4,384 KB
testcase_31 AC 129 ms
4,380 KB
testcase_32 AC 130 ms
4,376 KB
testcase_33 AC 130 ms
4,376 KB
testcase_34 AC 131 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 130 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
void solve() {
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	long long K;
	cin >> N >> K;
	vector<long long> A(N);
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}
	long long l = 0, r = 1LL<<60, m;
	while( r-l > 1 ) {
		m = (l+r)>>1;
		long long s = 0, k = 0;
		for( long long i = 0; i < N; i++ ) {
			long long x = max(0LL, m-(A[i]+s));
			k += (i+x)/(i+1);
			s += (i+x)/(i+1)*(i+1);
		}
		if( k <= K ) {
			l = m;
		}else {
			r = m;
		}
	}
	cout << l << endl;
}
0