답안 #776598

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776598 2023-07-08T05:34:31 Z vjudge1 Magnus (COCI18_magnus) C++17
50 / 50
2 ms 3748 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+37;
vector<int> s(N), v(N);
vector<array<int, 2>> adj[N];
 
		
void f(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}
 
void dfs(int t, int skip, int b){
	v[t] = b;
 
 
	for(auto i: adj[t]){
 
		if(v[i[0]]!=b&&i[1]!=skip){
			dfs(i[0], skip, b);
		}	
	}
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
 
	//f();
 
	string s; cin >> s;

	string b = "HONI";
	int l=0, ans=0;

	for(int i=0; i<s.size(); i++){
		if(s[i]==b[l]){
			l++;
		}
		if(l==4){
			ans++; l=0;
		}
	}

	cout<<ans<<"\n";
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |  for(int i=0; i<s.size(); i++){
      |               ~^~~~~~~~~
magnus.cpp: In function 'void f()':
magnus.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  freopen("in.txt", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
magnus.cpp:10:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  freopen("out.txt", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 1 ms 3412 KB Output is correct
3 Correct 2 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3476 KB Output is correct
3 Correct 1 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3412 KB Output is correct
3 Correct 2 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3412 KB Output is correct
3 Correct 2 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 1 ms 3412 KB Output is correct
3 Correct 2 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3668 KB Output is correct
2 Correct 2 ms 3668 KB Output is correct
3 Correct 2 ms 3704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3668 KB Output is correct
2 Correct 2 ms 3668 KB Output is correct
3 Correct 2 ms 3740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3748 KB Output is correct
2 Correct 2 ms 3708 KB Output is correct
3 Correct 2 ms 3668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3748 KB Output is correct
2 Correct 2 ms 3668 KB Output is correct
3 Correct 2 ms 3744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3668 KB Output is correct
2 Correct 2 ms 3736 KB Output is correct
3 Correct 2 ms 3672 KB Output is correct