# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51584 | MatheusLealV | Laugh Analysis (IOI16_laugh) | C++17 | 7 ms | 2584 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 "laugh.h"
#include <bits/stdc++.h>
using namespace std;
int longest_laugh(string s)
{
int ans = 0, prev = -1;
char p;
for(int i = 0; i < s.size(); i++)
{
if(s[i] != 'h' and s[i] != 'a') continue;
int st = i;
p = (s[i] == 'h' ? 'a' : 'h');
i ++;
while(i < s.size() and s[i] == p)
{
i ++;
if(p == 'h') p = 'a';
else p = 'h';
}
ans = max(ans, i - st);
i --;
}
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... |