結果
問題 | No.929 よくあるボールを移動するやつ |
ユーザー |
|
提出日時 | 2019-11-23 00:58:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 707 ms |
コンパイル使用メモリ | 91,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 06:39:55 |
合計ジャッジ時間 | 1,562 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 |
ソースコード
#include<iostream>#include<algorithm>#include<cmath>#include<iomanip>#include<set>#include<map>#include<queue>#include<vector>using namespace std;typedef long long ll;const int MOD=1e9+7;int main() {cin.tie(0),cout.tie(0);ios::sync_with_stdio(false);ll n,b,ans=0,cnt=0;cin >> n;for(int i=1; i<=n; i++) {cin >> b;cnt+=b;ans+=abs(cnt-i);}cout << ans << endl;}