結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2020-03-07 19:55:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 560 bytes |
| コンパイル時間 | 601 ms |
| コンパイル使用メモリ | 68,864 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 14:27:24 |
| 合計ジャッジ時間 | 1,490 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 3 WA * 17 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;cin>>n;
vector<int> A(n);
for(int i = 0; n > i; i++){
cin>>A[i];
}
int ans = 10000000;
for(int i = 0; !i; i++){
for(int j = i; n > j; j+=2){
//i~j;
int p = 0;
int t = 0;
for(int z = 0; n > z; z++){
if(A[z]>max(0,1+min(z-i,j-z))){
p+=A[z]-max(0,1+min(z-i,j-z));
}else{
t+=max(0,1+min(z-i,j-z))-A[z];
}
}
if(p >= t){
ans = min(ans,p);
}
}
}
cout << ans << endl;
}