답안 #800869

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
800869 2023-08-02T01:12:12 Z gun_gan Homework (CEOI22_homework) C++17
13 / 100
77 ms 69008 KB
#include <bits/stdc++.h>
using namespace std;

const int MX = 2e6 + 5;

int N;
vector<int> g[MX];
bool type[MX];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	string s;
	cin >> s;
	
	N = s.size();
	
	vector<int> v;
	
	int m = 0;
	for(int i = 0; i < N; i++) {
		// cout << i << " " << s[i] << '\n';
		if(s[i] == '?') { 
			i++;
			m++;
			continue;
		}
		if(s[i] != 'm') continue;
		
		if(s[i + 1] == 'a') {
			v.push_back(1);
			i += 3;
		} else {
			v.push_back(0);
			i += 3;
		}
	}
	// cout << '\n';
	
	reverse(v.begin(), v.end());
	
	int l = 1, r = m; 
	for(auto x : v) {
		if(x) {
			l++;
			r = m;
		} else {
			r--;
			l = 1;
		}
		// cout << l << " " << r << " " << x << '\n';
	}
	
	cout << r - l + 1 << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 47184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 47184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 68932 KB Output is correct
2 Correct 53 ms 68996 KB Output is correct
3 Correct 62 ms 69008 KB Output is correct
4 Correct 77 ms 68888 KB Output is correct
5 Correct 56 ms 68928 KB Output is correct
6 Correct 53 ms 68924 KB Output is correct
7 Correct 60 ms 68892 KB Output is correct
8 Correct 59 ms 68964 KB Output is correct
9 Correct 55 ms 68888 KB Output is correct
10 Correct 53 ms 68908 KB Output is correct
11 Correct 59 ms 68892 KB Output is correct
12 Correct 54 ms 68976 KB Output is correct
13 Correct 26 ms 47260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 47184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 47184 KB Output isn't correct
2 Halted 0 ms 0 KB -