Submission #94710

# Submission time Handle Problem Language Result Execution time Memory
94710 2019-01-23T06:46:07 Z AKaan37 Magnus (COCI18_magnus) C++17
50 / 50
6 ms 508 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair<int,int> PII;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR for(int i=1;i<=  n;i++)
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mid (start+end)/2

const lo mod = 1000000007;
const lo li = 100005;
const lo inf = 1000000000;
const lo MAX = 1000000000000000000;
const lo MIN = -1000000000000000000;
const lo LOG = 30;

lo n,m,cev,ok;
string s;

int main(){
	cin>>s;
	n=s.size();
	for(lo i=0;i<n;i++){
		if(s[i]=='H' && ok==0) ok++;
		if(s[i]=='O' && ok==1) ok++;
		if(s[i]=='N' && ok==2) ok++;
		if(s[i]=='I' && ok==3){ok=0;cev++;}
	}
	cout<<cev<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 6 ms 504 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 508 KB Output is correct
2 Correct 6 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 508 KB Output is correct
2 Correct 6 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 6 ms 504 KB Output is correct
3 Correct 6 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 6 ms 504 KB Output is correct