Submission #1121335

#TimeUsernameProblemLanguageResultExecution timeMemory
1121335qrnMagnus (COCI18_magnus)C++14
50 / 50
2 ms760 KiB
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define pb push_back #define endl "\n" #define ALL(x) x.begin(), x.end() #define intt long long const intt mxN = 2e5 + 5, L = 20, mxA = 5e5 + 35; char g[4] = {'H', 'O', 'N', 'I'}; void solve () { string s; cin >> s; int ans = 0, ind = 0; for(int i = 0; i < s.size(); i++) { if(s[i] == g[ind]) { ind++; if(ind == 4) { ind = 0; ans++; } } } cout << ans << endl; } int main() { SPEED; int tst = 1; // cin >> tst; while (tst--) { solve(); } return 0; }

Compilation message (stderr)

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