結果
| 問題 |
No.3015 右に寄せろ!
|
| コンテスト | |
| ユーザー |
のらら
|
| 提出日時 | 2025-01-19 01:18:14 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 515 bytes |
| コンパイル時間 | 3,017 ms |
| コンパイル使用メモリ | 172,028 KB |
| 実行使用メモリ | 7,576 KB |
| 最終ジャッジ日時 | 2025-01-25 21:58:34 |
| 合計ジャッジ時間 | 4,639 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
//制約チェック
#include <iostream>
#include <algorithm>
#include <atcoder/all>
#include <cassert>
using namespace std;
using namespace atcoder;
using ll = long long;
string S;
int main(){
cin >> S;
int sizeS = (int)S.size();
assert(1 <= sizeS && sizeS <= 2000000);
ll ans = 0;
ll one = 0;
for(int i = 0; i < sizeS; i++){
assert(S[i] == '0' || S[i] == '1');
if(S[i] == '0'){
ans += one / 2;
one -= one % 2;
}else{
one++;
}
}
cout << ans << endl;
return 0;
}
のらら