# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
563179 | Kanten4205 | Laugh Analysis (IOI16_laugh) | C++17 | 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>
using namespace std;
const long long MOD1 = 1000000007;
const long long MOD2 = 998244353;
typedef long long ll;
typedef pair<ll, ll> P;
const long long INF = 1e17;
ll longest_laugh(string S) {
ll ans = 0, ans2 = 0;
ll num = 0;
for (ll i = 0; i < S.size(); i++) {
if (num % 2 == 0) {
if (S[i] == 'a') num++;
else {
ans = max(ans, num);
num = 0;
}
}
else {
if (S[i] == 'h') num++;
else {
ans = max(ans, num);
num = 0;
}
}
}
num = 0;
for (ll i = 0; i < S.size(); i++) {
if (num % 2 == 0) {
if (S[i] == 'h') num++;
else {
ans2 = max(ans2, num);
num = 0;
}
}
else {
if (S[i] == 'a') num++;
else {
ans2 = max(ans2, num);
num = 0;
}
}
}
return max(ans, ans2);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |