Submission #170342

#TimeUsernameProblemLanguageResultExecution timeMemory
170342ngmhLaugh Analysis (IOI16_laugh)C++11
100 / 100
8 ms760 KiB
#include "laugh.h" #include <bits/stdc++.h> using namespace std; int longest_laugh(string s) { int best = 0, current = 1; for(int i = 1; i < s.size(); i++){ if((s[i-1] == 'a' && s[i] == 'h') || (s[i-1] == 'h' && s[i] == 'a')) current++; else { best = max(best, current); current = 1; } } best = max(best, current); return best; }

Compilation message (stderr)

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