結果
| 問題 | No.929 よくあるボールを移動するやつ |
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-09 10:35:52 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 413 bytes |
| 記録 | |
| コンパイル時間 | 965 ms |
| コンパイル使用メモリ | 181,052 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-08 04:25:30 |
| 合計ジャッジ時間 | 2,138 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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