Submission #942647

#TimeUsernameProblemLanguageResultExecution timeMemory
942647josanneo22Laugh Analysis (IOI16_laugh)C++17
100 / 100
3 ms704 KiB
#include <bits/stdc++.h> using namespace std; using i64 = long long; #define L(i, j, k) for (int i = (j); i <= (k); ++i) #define R(i, j, k) for (int i = (j); i >= (k); --i) int longest_laugh(string s) { int N = s.size(), ans = 0; for (int i = 0; i < N;) { if (s[i] != 'a' && s[i] != 'h') { i++; continue; } int j = i; while (j + 1 < N && ((s[j + 1] == 'a' && s[j] == 'h') || (s[j + 1] == 'h' && s[j] == 'a'))) j++; ans = max(ans, j - i + 1); if(i == j) i++; else i = j; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...