Submission #562117

# Submission time Handle Problem Language Result Execution time Memory
562117 2022-05-14T05:43:07 Z AGE Magnus (COCI18_magnus) C++14
50 / 50
5 ms 640 KB
#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;
    char last='I';
    for(int ii=0;ii<s.size();ii++){

        if(s[ii]=='H'&&last=='I')
            h++,last='H';

        if(s[ii]=='O'&&last=='H')
            o++,last='O';

        if(s[ii]=='N'&&last=='O')
            n++,last='N';

        if(s[ii]=='I'&&last=='N')
            i++,last='I';

    }


    cout<<min({h,o,n,i})<<endl;

    return 0;
}

Compilation message

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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Correct 4 ms 564 KB Output is correct
3 Correct 4 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB Output is correct
2 Correct 4 ms 596 KB Output is correct
3 Correct 5 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Correct 4 ms 572 KB Output is correct
3 Correct 5 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 512 KB Output is correct
2 Correct 4 ms 596 KB Output is correct
3 Correct 5 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 520 KB Output is correct
2 Correct 4 ms 560 KB Output is correct
3 Correct 4 ms 640 KB Output is correct