# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
563179 | 2022-05-16T12:42:44 Z | Kanten4205 | Laugh Analysis (IOI16_laugh) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; const long long MOD1 = 1000000007; const long long MOD2 = 998244353; typedef long long ll; typedef pair<ll, ll> P; const long long INF = 1e17; ll longest_laugh(string S) { ll ans = 0, ans2 = 0; ll num = 0; for (ll i = 0; i < S.size(); i++) { if (num % 2 == 0) { if (S[i] == 'a') num++; else { ans = max(ans, num); num = 0; } } else { if (S[i] == 'h') num++; else { ans = max(ans, num); num = 0; } } } num = 0; for (ll i = 0; i < S.size(); i++) { if (num % 2 == 0) { if (S[i] == 'h') num++; else { ans2 = max(ans2, num); num = 0; } } else { if (S[i] == 'a') num++; else { ans2 = max(ans2, num); num = 0; } } } return max(ans, ans2); }
Compilation message
# | 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 | - |