Submission #654956

#TimeUsernameProblemLanguageResultExecution timeMemory
654956KiriLL1caAron (COCI17_aron)C++14
50 / 50
1 ms328 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define fr first #define sc second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pw(x) (1ll << x) #define sz(x) (int)((x).size()) #define pb push_back #define endl '\n' #define mp make_pair #define vec vector using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair <int, int> pii; typedef pair <ll, ll> pll; typedef unsigned long long ull; typedef unsigned int uint; template <typename T> inline bool umin (T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template <typename T> inline bool umax (T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> using oset = tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; inline void solve () { int q; cin >> q; char c; cin >> c; --q; int cnt = 1; while (q--) { char x; cin >> x; if (x != c) c = x, ++cnt; } cout << cnt + 1 << endl; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t = 1; // cin >> t; while (t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...