Submission #494864

# Submission time Handle Problem Language Result Execution time Memory
494864 2021-12-16T21:37:09 Z Christopher_ Laugh Analysis (IOI16_laugh) C++17
0 / 100
1 ms 344 KB
#include "laugh.h"
#include <bits/stdc++.h>

using namespace std;

int longest_laugh(std::string s)
{
  int cnt = 0;
  char last = 'z';
  int mx = 0;
  for (int i = 0; i < (int) s.size(); ++i) {
    if ((s[i] == 'a' || s[i] == 'h') && s[i] != last) {
      ++cnt;
      if (last == 'z') last = s[i];
      else if (last == 'a') last = 'h';
      else last = 'a';
    } else {
      last = 'z';
      mx = max(mx, cnt);
      cnt = 0;
    }
  }
  mx = max(mx, cnt);
  return mx;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 292 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 292 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 292 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -