Submission #494865

#TimeUsernameProblemLanguageResultExecution timeMemory
494865Christopher_Laugh Analysis (IOI16_laugh)C++17
0 / 100
0 ms204 KiB
#include "laugh.h" #include <bits/stdc++.h> using namespace std; int longest_laugh(std::string s) { int cnt = 0; char last = 'z'; int mx = 0; for (int i = 0; i < (int) s.size(); ++i) { if (last == 'z' && (s[i] == 'a' || s[i] == 'h')) { last = s[i]; ++cnt; } else if ((s[i] == 'a' || s[i] == 'h') && s[i] != last) { ++cnt; if (last == 'z') last = s[i]; else if (last == 'a') last = 'h'; else last = 'a'; } else { last = 'z'; mx = max(mx, cnt); cnt = 0; } } mx = max(mx, cnt); return mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...