結果
| 問題 | No.77 レンガのピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-01 01:59:58 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 514 bytes |
| 記録 | |
| コンパイル時間 | 3,120 ms |
| コンパイル使用メモリ | 278,564 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-01-01 02:00:03 |
| 合計ジャッジ時間 | 4,594 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 3 WA * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> A(N);
for(int i = 0; i < N; ++i) cin >> A[i];
int Asum = 0;
for(int i = 0; i < N; ++i) Asum += A[i];
int ans = 1e9;
for(int t = 1; t * t <= Asum and t * 2 - 1 <= N; ++t) {
vector<int> B(N, 0);
for(int i = 0; i < t; ++i) B[i] = B[t * 2 - 2 - i] = i + 1;
int rem = 0;
for(int i = 0; i < N; ++i) if(A[i] > B[i]) rem += (A[i] - B[i]);
ans = min(ans, rem);
}
cout << ans << "\n";
return 0;
}