結果
問題 |
No.77 レンガのピラミッド
|
ユーザー |
👑 |
提出日時 | 2020-03-07 19:52:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 591 ms |
コンパイル使用メモリ | 69,376 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 14:25:00 |
合計ジャッジ時間 | 1,501 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; n > 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; }