結果
| 問題 |
No.77 レンガのピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-05 00:48:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 426 bytes |
| コンパイル時間 | 1,862 ms |
| コンパイル使用メモリ | 193,468 KB |
| 最終ジャッジ日時 | 2025-01-07 10:43:05 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 WA * 1 |
| other | AC * 19 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin>>n;
int a[n];
int sum=0;
for (int i=0;i<n;i++){cin>>a[i];sum+=a[i];}
int row=sqrt(sum);
int ans=0;
for (int i=0;i<n&&i<row;i++)
if (a[i]>i+1) ans += a[i]-(i+1);
for (int i=row;i<n&&i<2*row-1;i++)
if (a[i]>2*row-1-i) ans += a[i]-(2*row-1-i);
cout << ans << endl;
return 0;
}