Submission #97450

# Submission time Handle Problem Language Result Execution time Memory
97450 2019-02-16T09:24:42 Z KLPP Magnus (COCI18_magnus) C++14
50 / 50
9 ms 768 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;

int main(){
	string s;
	cin>>s;
	string pattern="HONI";
	int pnt=0;
	int cnt=0;
	for(int i=0;i<s.size();i++){
		if(s.at(i)==pattern.at(pnt)){
			pnt++;
			if(pnt==pattern.size()){
				pnt=0;
				cnt++;
			}
		}
	}cout<<cnt<<endl;
	return 0;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:12:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<s.size();i++){
              ~^~~~~~~~~
magnus.cpp:15:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(pnt==pattern.size()){
       ~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 640 KB Output is correct
2 Correct 9 ms 768 KB Output is correct
3 Correct 6 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 640 KB Output is correct
2 Correct 9 ms 640 KB Output is correct
3 Correct 6 ms 612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 768 KB Output is correct
2 Correct 7 ms 640 KB Output is correct
3 Correct 6 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 640 KB Output is correct
2 Correct 7 ms 640 KB Output is correct
3 Correct 8 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 640 KB Output is correct
2 Correct 6 ms 640 KB Output is correct
3 Correct 9 ms 768 KB Output is correct