제출 #563182

#제출 시각아이디문제언어결과실행 시간메모리
563182Kanten4205Laugh Analysis (IOI16_laugh)C++17
0 / 100
0 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; } } } ans = max(ans, num); 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; } } } ans2 = max(ans2, num); return max(ans, ans2); }

컴파일 시 표준 에러 (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:29: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]
   29 |     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...