Submission #987195

# Submission time Handle Problem Language Result Execution time Memory
987195 2024-05-22T10:15:29 Z 0pt1mus23 Magnus (COCI18_magnus) C++14
50 / 50
2 ms 608 KB
#pragma GCC optimize("O3","inline")
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define ins insert
#define pb push_back
#define int long long
#define pii pair<int,int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl;return;
#define reach cerr<<"reached >.<!"<<endl;
/*
    m : 11059739 -> l ~23
    p : 4567896467
*/
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod =  1e9 +7, sze=2e5 +5,inf=LLONG_MAX, prime = 2333;

//\\
:pepeblacklove:  :dp/st/sp/bs/gr: :pepeblacklove:  
//

void gkd(){
    string s;
    cin>>s;
    int ans=0;
    int n=s.length();
    char next = 'H';
    for(int i=0;i<n;i++){
        if(s[i]==next){
            if(s[i]=='I'){
                ans++;
            }
            if(next=='H'){
                next='O';
            }
            else if(next=='O'){
                next='N';
            }
            else if(next=='N'){
                next='I';
            }
            else if(next=='I'){
                next='H';
            }
        }
    }
    drop(ans);
}

signed main(){
    cin.tie(0)->sync_with_stdio(0);
    int tt=1; 
    // cin>>tt;
    while(tt--) gkd();
    
    return 0;
}

Compilation message

magnus.cpp:19:1: warning: multi-line comment [-Wcomment]
   19 | //\\
      | ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 456 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 608 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 1 ms 604 KB Output is correct