結果
| 問題 | No.929 よくあるボールを移動するやつ |
| コンテスト | |
| ユーザー |
kazuma
|
| 提出日時 | 2019-11-22 21:43:02 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 340 bytes |
| 記録 | |
| コンパイル時間 | 1,161 ms |
| コンパイル使用メモリ | 210,668 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-08 04:37:28 |
| 合計ジャッジ時間 | 2,001 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios::sync_with_stdio(false), cin.tie(0);
int N;
cin >> N;
vector<int> B(N);
for (int i = 0; i < N; i++) {
cin >> B[i];
}
ll res = 0, pre = 0;
for (int i = 0; i < N; i++) {
res += abs(pre);
pre += B[i] - 1;
}
cout << res << endl;
return 0;
}
kazuma