結果
問題 |
No.1469 programing
|
ユーザー |
![]() |
提出日時 | 2021-04-09 21:20:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 81 ms / 3,000 ms |
コード長 | 608 bytes |
コンパイル時間 | 2,078 ms |
コンパイル使用メモリ | 196,144 KB |
最終ジャッジ日時 | 2025-01-20 13:19:25 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#include "bits/stdc++.h" //#define int long long using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = (1LL << 61); ll mod = 1000000007; vector<pair<char, int>> RunLength(string s) { if (s.size() == 0)return {}; vector<pair<char, int>>res(1, pair<char, int>(s[0], 0)); for (char p : s) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } signed main() { ios::sync_with_stdio(false); cin.tie(0); string S; cin >> S; auto p = RunLength(S); for (auto x : p) { cout << x.first; }cout << endl; return 0; }