Submission #23990

#TimeUsernameProblemLanguageResultExecution timeMemory
23990gs14004Laugh Analysis (IOI16_laugh)C++11
100 / 100
6 ms2728 KiB
#include "laugh.h" #include <bits/stdc++.h> using namespace std; int longest_laugh(string s) { vector<int> dp(s.size()); for(int i=1; i<dp.size(); i++){ if(s[i-1] == 'a' && s[i] == 'h') dp[i] = dp[i-1] + 1; else if(s[i-1] == 'h' && s[i] == 'a') dp[i] = dp[i-1] + 1; } return *max_element(dp.begin(), dp.end()) + 1; }

Compilation message (stderr)

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