結果
問題 |
No.3114 0→1
|
ユーザー |
![]() |
提出日時 | 2025-04-20 02:02:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 538 bytes |
コンパイル時間 | 2,206 ms |
コンパイル使用メモリ | 197,060 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-04-20 02:02:43 |
合計ジャッジ時間 | 3,025 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | WA * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using lint = long long; vector<pair<char, int>> rlencoding(string vec) { vector<pair<char, int>> res = {{vec[0], 1}}; int n = (int)vec.size(); for (int i = 1; i < n; i++) { if (vec[i] == res.back().first) res.back().second++; else res.push_back({vec[i], 1}); } return res; } int main() { int n; cin >> n; string s; cin >> s; vector vec = rlencoding(s); int ans = 0; for (auto [x, y]: vec) { if (x == 0 && y >= 2) ans += y/2; } cout << ans << endl; }