Submission #980632

#TimeUsernameProblemLanguageResultExecution timeMemory
980632NoMercyLaugh Analysis (IOI16_laugh)C++17
0 / 100
0 ms348 KiB
#include "laugh.h" #include <bits/stdc++.h> using namespace std; int longest_laugh(string S) { int N = S.size(); S = '-' + S; vector<int> dp(N + 1 , 0); for (int i = 1;i <= N;i ++) { if (S[i] == 'a' || S[i] == 'h') { dp[i] = 1; } else { dp[i] = 0; } if (S[i] == 'a' && S[i - 1] == 'h') { dp[i] += dp[i - 1]; } else if (S[i] == 'h' && S[i - 1] == 'a') { dp[i] += dp[i - 1]; } } int eded = *max_element(dp.begin() , dp.end()); return (eded == 1 ? 0 : eded); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...