Submission #563179

#TimeUsernameProblemLanguageResultExecution timeMemory
563179Kanten4205Laugh Analysis (IOI16_laugh)C++17
0 / 100
1 ms212 KiB
#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 (stderr)

laugh.cpp: In function 'll longest_laugh(std::string)':
laugh.cpp:11:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (ll i = 0; i < S.size(); i++) {
      |                    ~~^~~~~~~~~~
laugh.cpp:28:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for (ll i = 0; i < S.size(); i++) {
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...