結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
Kutimoti_T
|
| 提出日時 | 2017-12-27 23:17:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 632 bytes |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 55,028 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-21 08:12:19 |
| 合計ジャッジ時間 | 1,192 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 4 |
| other | AC * 1 WA * 19 |
ソースコード
#include <iostream>
using namespace std;
#define FOR(i,s,e) for(int i = (s);i <=(e);i++)
int total;
int N;
int a[100];
int result = 10000;
int main()
{
cin >> N;
FOR(i,0,N - 1)
{
cin >> a[i];
total += a[i];
}
int memo = 0;
FOR(i,1,N)
{
memo += i + i - 1;
if(total < memo || i + i - 1 >= N) break;
int cou = 1;
int temp = 0;
FOR(j,0,i - 1)
{
if(cou < a[j]) temp += a[j] - cou;
cou++;
}
cou = i - 1;
FOR(j,i,i + i - 1)
{
if(cou < a[j]) temp += a[j] - cou;
cou--;
}
FOR(j,i + i,N - 1)
{
temp += a[j];
}
result = min(result,temp);
}
cout << result << endl;
return 0;
}
Kutimoti_T