結果
| 問題 |
No.929 よくあるボールを移動するやつ
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-09 10:35:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 413 bytes |
| コンパイル時間 | 1,733 ms |
| コンパイル使用メモリ | 167,576 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 20:53:16 |
| 合計ジャッジ時間 | 2,822 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
ソースコード
#include<bits/stdc++.h>
#define endl enjoy_codeforces
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
int n;std::cin>>n;
std::vector<int>a(n);
for(int i=0,j=0;i<n;i++){
int x;std::cin>>x;
while(x--){
a.at(j++)=i;
}
}
long long ans=0;
for(int i=0;i<n;i++){
ans+=std::abs(i-a.at(i));
}
std::cout<<ans<<'\n';
}
ngtkana