Submission #965570

#TimeUsernameProblemLanguageResultExecution timeMemory
965570AdamGSLaugh Analysis (IOI16_laugh)C++17
100 / 100
3 ms788 KiB
#include "laugh.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
int longest_laugh(string s) {
  int akt=0, ans=0;
  rep(i, s.size()) {
    if(s[i]=='a' || s[i]=='h') {
      ++akt;
      if(i && s[i]==s[i-1]) akt=1;
      ans=max(ans, akt);
    } else akt=0;
  }
  return ans;
}

Compilation message (stderr)

laugh.cpp: In function 'int longest_laugh(std::string)':
laugh.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
laugh.cpp:12:3: note: in expansion of macro 'rep'
   12 |   rep(i, s.size()) {
      |   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...