結果

問題 No.484 収穫
ユーザー pekempey
提出日時 2017-02-10 23:36:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 71,964 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-29 05:39:48
合計ジャッジ時間 1,668 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	long long ans = 1e18;
	for (int ii = 0; ii < n; ii++) {
		long long ll = 0;
		long long rr = 0;
		long long tt = 0;
		for (int i = 0; i < n; i++) {
			long long y = a[i];
			long long x = i - ii;
			long long yy = y + x;
			long long xx = y - x;
			ll = min(ll, xx);
			rr = max(rr, xx);
			tt = max(tt, yy);
		}
		ans = min(ans, (tt + 1) / 2 + (rr + 1) / 2);
	}
	cout << ans << endl;
}
0