Submission #292969

# Submission time Handle Problem Language Result Execution time Memory
292969 2020-09-07T15:11:10 Z 7_7_7 Magnus (COCI18_magnus) C++17
15 / 50
3 ms 768 KB
#include <bits/stdc++.h>

using namespace std;

int f(char c){
    if(c == 'H') return 0;
    if(c == 'O') return 1;
    if(c == 'N') return 2;
    if(c == 'I') return 3;
    return -1;
}
int main()
{
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;
    vector<int> cnt(4);
    for(int i = 0; i < (int)s.size(); i ++){
        if(f(s[i]) != -1){
            if(f(s[i]) == 0){
                cnt[f(s[i])] = max(cnt[f(s[i])], 1);
            }else{
                if(cnt[f(s[i]) - 1] > 0){
                    cnt[f(s[i]) - 1] --;
                    cnt[f(s[i])] ++;
                }
            }
        }
    }
    cout << cnt.back() << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 672 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -