Submission #539171

#TimeUsernameProblemLanguageResultExecution timeMemory
539171astoriaLaugh Analysis (IOI16_laugh)C++14
100 / 100
4 ms596 KiB
#include <bits/stdc++.h> #include "laugh.h" using namespace std; int longest_laugh(string s){ int n = s.length(); char lastchar = '-'; int clen = 0; int mlen = 0; for (int i=0; i<n; i++){ if (clen == 0){ if (s[i] == 'a' || s[i] == 'h'){ lastchar = s[i]; clen = 1; } } else{ if (lastchar == 'a'){ if (s[i] == 'h'){ clen++; lastchar = s[i];} else if (s[i] == 'a'){ clen=1; lastchar=s[i];} else{ lastchar = '-'; clen = 0;} } else if (lastchar == 'h'){ if (s[i] == 'a'){ clen++; lastchar = s[i];} else if (s[i] == 'h'){ clen=1; lastchar=s[i];} else{lastchar = '-'; clen=0;} } } mlen = max(clen,mlen); } return mlen; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...