Submission #939393

#TimeUsernameProblemLanguageResultExecution timeMemory
939393KK_1729Laugh Analysis (IOI16_laugh)C++17
Compilation error
0 ms0 KiB
#include "laugh.h" #include <bits/stdc++.h> using namespace std; int longest_laugh(string s) { int n = s.size(); vector<int> dp(n); if (s[0] == 'h' || s[0] == 'a') dp[0] = 1; FOR(i,0,n){ if (s[i] == 'h'){ if (s[i-1] == 'a') dp[i] = dp[i-1]+1; } if (s[i] == 'a'){ if (s[i-1] == 'h') dp[i] = dp[i-1]+1; } } int ans = 0; for (auto x: dp) ans = max(ans, x); return ans; }

Compilation message (stderr)

laugh.cpp: In function 'int longest_laugh(std::string)':
laugh.cpp:9:9: error: 'i' was not declared in this scope
    9 |     FOR(i,0,n){
      |         ^
laugh.cpp:9:5: error: 'FOR' was not declared in this scope
    9 |     FOR(i,0,n){
      |     ^~~