Submission #162564

#TimeUsernameProblemLanguageResultExecution timeMemory
162564dolphingarlicLaugh Analysis (IOI16_laugh)C++14
0 / 100
2 ms376 KiB
#include "laugh.h" int longest_laugh(std::string s) { int ans = 0, curr = 0; for (int i = 0; i < s.size(); i++) { if ((s[i] == 'a' && (i == 0 || s[i - 1] == 'h')) || (s[i] == 'h' && (i == 0 || s[i - 1] == 'a'))) curr++; else curr = 0; ans = (ans > curr ? ans : curr); } return ans; }

Compilation message (stderr)

laugh.cpp: In function 'int longest_laugh(std::__cxx11::string)':
laugh.cpp:5:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < s.size(); i++) {
                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...