Submission #88423

# Submission time Handle Problem Language Result Execution time Memory
88423 2018-12-05T20:54:32 Z xiaowuc1 Laugh Analysis (IOI16_laugh) C++14
100 / 100
10 ms 2788 KB
#include <bits/stdc++.h>

using namespace std;

int solve(string a, string b) {
  int r = 0;
  int c = 0;
  for(int i = 0; i < a.size(); i++) {
    if(a[i] == b[i%b.size()]) c++;
    else c = 0;
    r = max(r, c);
  }
  return r;
}

int longest_laugh(string s) {
  return max(solve(s, "ha"), solve(s, "ah"));
}

/*
void solve() {

}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
*/

Compilation message

laugh.cpp: In function 'int solve(std::__cxx11::string, std::__cxx11::string)':
laugh.cpp:8:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < a.size(); i++) {
                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 448 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
5 Correct 2 ms 448 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 540 KB Output is correct
9 Correct 2 ms 540 KB Output is correct
10 Correct 2 ms 556 KB Output is correct
11 Correct 2 ms 556 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 3 ms 624 KB Output is correct
14 Correct 2 ms 624 KB Output is correct
15 Correct 2 ms 624 KB Output is correct
16 Correct 2 ms 624 KB Output is correct
17 Correct 2 ms 624 KB Output is correct
18 Correct 2 ms 624 KB Output is correct
19 Correct 2 ms 624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 448 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
5 Correct 2 ms 448 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 540 KB Output is correct
9 Correct 2 ms 540 KB Output is correct
10 Correct 2 ms 556 KB Output is correct
11 Correct 2 ms 556 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 3 ms 624 KB Output is correct
14 Correct 2 ms 624 KB Output is correct
15 Correct 2 ms 624 KB Output is correct
16 Correct 2 ms 624 KB Output is correct
17 Correct 2 ms 624 KB Output is correct
18 Correct 2 ms 624 KB Output is correct
19 Correct 2 ms 624 KB Output is correct
20 Correct 2 ms 712 KB Output is correct
21 Correct 2 ms 712 KB Output is correct
22 Correct 2 ms 828 KB Output is correct
23 Correct 2 ms 828 KB Output is correct
24 Correct 2 ms 828 KB Output is correct
25 Correct 2 ms 828 KB Output is correct
26 Correct 2 ms 828 KB Output is correct
27 Correct 2 ms 828 KB Output is correct
28 Correct 3 ms 828 KB Output is correct
29 Correct 2 ms 908 KB Output is correct
30 Correct 2 ms 908 KB Output is correct
31 Correct 2 ms 908 KB Output is correct
32 Correct 2 ms 908 KB Output is correct
33 Correct 2 ms 908 KB Output is correct
34 Correct 2 ms 908 KB Output is correct
35 Correct 2 ms 908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 448 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
5 Correct 2 ms 448 KB Output is correct
6 Correct 2 ms 448 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 540 KB Output is correct
9 Correct 2 ms 540 KB Output is correct
10 Correct 2 ms 556 KB Output is correct
11 Correct 2 ms 556 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 3 ms 624 KB Output is correct
14 Correct 2 ms 624 KB Output is correct
15 Correct 2 ms 624 KB Output is correct
16 Correct 2 ms 624 KB Output is correct
17 Correct 2 ms 624 KB Output is correct
18 Correct 2 ms 624 KB Output is correct
19 Correct 2 ms 624 KB Output is correct
20 Correct 2 ms 712 KB Output is correct
21 Correct 2 ms 712 KB Output is correct
22 Correct 2 ms 828 KB Output is correct
23 Correct 2 ms 828 KB Output is correct
24 Correct 2 ms 828 KB Output is correct
25 Correct 2 ms 828 KB Output is correct
26 Correct 2 ms 828 KB Output is correct
27 Correct 2 ms 828 KB Output is correct
28 Correct 3 ms 828 KB Output is correct
29 Correct 2 ms 908 KB Output is correct
30 Correct 2 ms 908 KB Output is correct
31 Correct 2 ms 908 KB Output is correct
32 Correct 2 ms 908 KB Output is correct
33 Correct 2 ms 908 KB Output is correct
34 Correct 2 ms 908 KB Output is correct
35 Correct 2 ms 908 KB Output is correct
36 Correct 8 ms 1412 KB Output is correct
37 Correct 9 ms 1496 KB Output is correct
38 Correct 7 ms 1584 KB Output is correct
39 Correct 7 ms 1672 KB Output is correct
40 Correct 8 ms 1760 KB Output is correct
41 Correct 8 ms 1840 KB Output is correct
42 Correct 7 ms 1972 KB Output is correct
43 Correct 6 ms 1972 KB Output is correct
44 Correct 8 ms 2076 KB Output is correct
45 Correct 10 ms 2176 KB Output is correct
46 Correct 8 ms 2276 KB Output is correct
47 Correct 8 ms 2376 KB Output is correct
48 Correct 8 ms 2476 KB Output is correct
49 Correct 9 ms 2576 KB Output is correct
50 Correct 8 ms 2676 KB Output is correct
51 Correct 9 ms 2788 KB Output is correct