Submission #956591

#TimeUsernameProblemLanguageResultExecution timeMemory
956591DeltaStructLaugh Analysis (IOI16_laugh)C++17
100 / 100
4 ms612 KiB
#include <bits/stdc++.h> #include "laugh.h" using namespace std; int longest_laugh(string s){ int r = 0; for (int i(0),k(0),j(0);i < s.size();++i){ k = (s[i]==string("ah")[k&1]?k+1:(int)(s[i]=='a')); j = (s[i]==string("ha")[j&1]?j+1:(int)(s[i]=='h')); r = max({r,k,j}); } return r; }

Compilation message (stderr)

laugh.cpp: In function 'int longest_laugh(std::string)':
laugh.cpp:7:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   for (int i(0),k(0),j(0);i < s.size();++i){
      |                           ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...