# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654958 | nifeshe | Aron (COCI17_aron) | C++14 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
//#pragma GCC target ("avx2")
//#pragma GCC optimize ("O3")
//#pragma GCC optimize ("unroll-loops")
//#pragma comment (linker, "/STACK: 268435456")
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define int unsigned int
using namespace std;
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; }
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll mod = 998244353;
ll base = 1e6 + 9;
int inf = 3e9;
int MAX = 5e4 + 5;
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<ll> dis(1, inf);
void solve() {
int n;
cin >> n;
char lst = '#';
int ans = 1;
for(int i = 0; i < n; i++) {
char c;
cin >> c;
if(c == lst) {
continue;
}
ans++;
lst = c;
}
cout << ans << '\n';
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int ttt = 1;
//cin >> ttt;
int ttt0 = ttt;
while(ttt--) {
solve();
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |