結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-30 01:26:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 612 bytes |
| コンパイル時間 | 2,087 ms |
| コンパイル使用メモリ | 198,024 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2025-06-30 01:26:56 |
| 合計ジャッジ時間 | 3,438 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<int> A(N);
int suma = 0;
for(auto &a : A) cin >> a,suma += a;
A.resize(209);
int answer = 1001001001;
for(int i=1; i<=104; i++){
int h = 0,dh = 1,now = 0,use = 0;
for(int k=0; k<209; k++){
if(h == i) dh *= -1;
h += dh,h = max(h,0);
use += h;
now += max(0,A.at(k)-h);
}
if(use > suma) break;
answer = min(answer,now);
}
cout << answer << endl;
}