# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1124370 | caf_sq | Laugh Analysis (IOI16_laugh) | C++20 | 3 ms | 840 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int longest_laugh(string S) {
string t;
int ans = 0;
for(auto &i : S) {
if(i == 'a') {
if(t.empty() || t.back() == 'h') { t += 'a'; }
else { t = "a"; }
}
else if(i == 'h') {
if(t.empty() || t.back() == 'a') { t += 'h'; }
else { t = "h"; }
}
else { t.clear(); }
ans = max(ans, (int)t.size());
}
return ans;
}
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... |