# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1187570 | weakweakweak | Laugh Analysis (IOI16_laugh) | C++20 | 0 ms | 324 KiB |
#include <bits/stdc++.h>
using namespace std;
int longest_laugh(std::string s) {
int n = s.size();
int ans = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'a' or s[i] == 'h') {
int j = i;
while (j+1 < n and s[j+1] != s[i] and (s[j+1] == 'a' or s[j+1] == 'h')) j++;
ans = max(ans, j-i+1);
i = j;
}
}
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... |