結果

問題 No.77 レンガのピラミッド
ユーザー nnasennnasen
提出日時 2017-12-23 12:50:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 730 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 166,756 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-09 22:11:27
合計ジャッジ時間 4,680 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 RE -
testcase_07 AC 2 ms
6,940 KB
testcase_08 RE -
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 RE -
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
#define MOD 1000007
#define INF 100000000
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;


int main() {
	int n;
	int a[101] = {};
	cin >> n;
	int sum = 0;
	REP(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	int k = 1;
	int t = sum;
	while ((t -= k) >= 0) {
		k += 2;
	}
	int na[101] = {};
	t = 0;
	REP(j, (k - 1) / 2) {
		na[j] = na[k - j - 3] = j + 1;
		t += na[j];
	}
	int ans = sum;
	REP(j, k) {
		ans -= min(a[j], na[j]);
	}
	cout << ans << endl;
	return 0;
}
0