Code Submission Evaluation System Login

CSES - HIIT Open 2017

HIIT Open 2017

Contest start:2017-05-27 11:00:00
Contest end:2017-05-27 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard


History
2017-05-27 11:07:11
Task:HIIT game
Sender:Game of Nolife
Submission time:2017-05-27 11:07:11
Status:READY
Result:ACCEPTED

Show test data

Code

#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	vector<char> v;
	int r=0;
	for (char c:s){
		v.push_back(c);
		int n=v.size();
		while (n>=4&&v[n-1]=='T'&&v[n-2]=='I'&&v[n-3]=='I'&&v[n-4]=='H'){
			v.pop_back();
			v.pop_back();
			v.pop_back();
			v.pop_back();
			n=v.size();
			r++;
		}
	}
	if (r%2==0){
		cout<<"Maija"<<endl;
	}
	else{
		cout<<"Uolevi"<<endl;
	}
}