| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1298733 | kantaponz | Laugh Analysis (IOI16_laugh) | C++20 | 4 ms | 588 KiB |
#include <bits/stdc++.h>
using namespace std;
int longest_laugh(string s) {
int N = s.size();
int ans = 0;
int cur = 0;
if (s[0] == 'a' || s[0] == 'h') cur++, ans++;
for (int i = 1; i < N; i++) {
if (s[i] == 'a' || s[i] == 'h') {
if ((s[i] == 'a' && s[i - 1] != 'h') || (s[i] == 'h' && s[i - 1] != 'a')) {
cur = 1;
} else {
cur++;
}
ans = max(ans, cur);
} else {
cur = 0;
}
}
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... | ||||
