Submission #162565

#TimeUsernameProblemLanguageResultExecution timeMemory
162565dolphingarlicLaugh Analysis (IOI16_laugh)C++14
100 / 100
13 ms760 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 if (s[i] == 'a' || s[i] == 'h') curr = 1; 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...