Submission #385838

# Submission time Handle Problem Language Result Execution time Memory
385838 2021-04-05T05:43:11 Z AdiZer0 Magnus (COCI18_magnus) C++17
50 / 50
4 ms 748 KB
#include <bits/stdc++.h>

#define pb push_back
#define whole(x) x.begin(), x.end()
#define sz(x) (int)x.size()

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = (int)1e5 + 7;
const int INF = (int)1e9 + 7;
const ll linf = (ll)1e18 + 1;

int main() {
    string s; cin >> s;
    char last = '#';
    int ans = 0;
    for (int i = 0; i < sz(s); ++i) { 
        if (last == '#' && s[i] == 'H') last = 'H';
        else { 
            if (last == 'H' && s[i] == 'O') last = 'O';
            else if (last == 'O' && s[i] == 'N') last = 'N';
            else if (last == 'N' && s[i] == 'I') { 
                last = '#';
                ++ans;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 620 KB Output is correct
2 Correct 4 ms 620 KB Output is correct
3 Correct 4 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 620 KB Output is correct
2 Correct 4 ms 620 KB Output is correct
3 Correct 4 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 620 KB Output is correct
2 Correct 4 ms 620 KB Output is correct
3 Correct 4 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 620 KB Output is correct
2 Correct 4 ms 620 KB Output is correct
3 Correct 4 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 620 KB Output is correct
2 Correct 4 ms 640 KB Output is correct
3 Correct 4 ms 620 KB Output is correct