Submission #562111

#TimeUsernameProblemLanguageResultExecution timeMemory
562111AGEMagnus (COCI18_magnus)C++14
20 / 50
4 ms596 KiB
#include<bits/stdc++.h> #define F first #define S second #define pb push_back #define int long long using namespace std; const int N=1e6,M=2e3,mod=1e9+7; main() { string s; cin>>s; int h=0,o=0,n=0,i=0; for(int ii=0;ii<s.size();ii++){ if(s[ii]=='H') h=min({o,n,i})+1; if(s[ii]=='O') o=min({h,n,i})+1; if(s[ii]=='N') n=min({h,o,i})+1; if(s[ii]=='I') i=min({h,o,n})+1; } cout<<min({h,o,n,i})<<endl; return 0; }

Compilation message (stderr)

magnus.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~
magnus.cpp: In function 'int main()':
magnus.cpp:16:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int ii=0;ii<s.size();ii++){
      |                  ~~^~~~~~~~~
#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...