Submission #1104292

# Submission time Handle Problem Language Result Execution time Memory
1104292 2024-10-23T12:09:31 Z overwatch9 Laugh Analysis (IOI16_laugh) C++17
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
using namespace std;
int longest_laugh(string s) {
    int ans = 0;
    int x = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] == 'h') {
            if (i-1 >= 0 && s[i-1] == 'a') {
                if (x == 0)
                    x = 1;
                x++;
            } else
                x = 0;
        } else if (s[i] == 'a') {
            if (i-1 >= 0 && s[i-1] == 'h') {
                if (x == 0)
                    x = 1;
                x++;
            } else
                x = 0;
        } else {
            x = 0;
        }
        ans = max(ans, x);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB numbers differ - expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB numbers differ - expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB numbers differ - expected: '1', found: '0'
2 Halted 0 ms 0 KB -