Start: Feb, 21, 2019 12:00:00
2018-2019 ACM集训队冬季集训第二次考核
End: Feb, 21, 2019 17:00:00
Time elapsed:
Time remaining:

Problem_ID: I
Result: Accepted
Time: 7ms
Memory: 1720kB
Author: 2017212212292
In contest: 1261

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <sstream>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include<cstdlib>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pi 3.14159265358979323846264338327
#define E 2.71828182846
#define inf 0x3f3f3f3f
#define maxn 2147493647
const ull mod=1<<64;
const int N=4e4+5,M=1e6+5;
const double inff=1e17;
int n;
vector<ll>num;
int main()
{
	int n,pos,cnt;
	while(scanf("%d",&n)!=EOF)
	{
		num.clear();
		for(int i=0;i<n;i++)
		{
			ll nu;
			scanf("%lld",&nu);
			if(nu>0)
				num.push_back(nu);
		}
		int flg=0;
		while(!num.empty())
		{
			flg=flg^1;
			ll tmp;
			int v=num[0];
			if(num.size()>1)
			{
				if(v!=1)
				{
					if(num[1]==1)
					{
						int i=1;
						int cou=0;
						while(i<num.size()&&num[i]==1)
						{
							cou++;
							i++;
						}
						if(num.size()-i>0)
						{
							if(cou%2==0)
								tmp=v-1;
							else
								tmp=v;
						}
						else
						{
							if(cou%2==0)
								tmp=v;
							else
								tmp=v-1;
						}
					}
					else
						tmp=v-1;
				}
				else
					tmp=1;
			}
			else
				tmp=v;
			num[0]-=tmp;;
			if(num[0]==0)
				num.erase(num.begin());
		}
		if(flg)
			printf("H\n");
		else
			printf("L\n");
	}
	return 0;
}