답안 #562111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
562111 2022-05-14T05:34:49 Z AGE Magnus (COCI18_magnus) C++14
20 / 50
4 ms 596 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;

    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

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++){
      |                  ~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -