Submission #562791

# Submission time Handle Problem Language Result Execution time Memory
562791 2022-05-15T10:02:08 Z silv723 Laugh Analysis (IOI16_laugh) C++14
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int longest_laugh(string s){
  int ans=0;
  s='z'+s;
  int now=0;
  for(int i=1;i<s.size();i++){
    if(s[i]!='h'&&s[i]!='a'){
      now=0;
      continue;
    }
    if(s[i]==s[i-1]){
      now=0;
      continue;
    }
    now++;
    ans=max(ans,now);
  }
  return ans;
}

Compilation message

laugh.cpp: In function 'int longest_laugh(std::string)':
laugh.cpp:8:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |   for(int i=1;i<s.size();i++){
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -