Result: Accepted
Time: 7ms
Memory: 1720kB
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
int n;
ll sum[1001];
int main()
{
while(~scanf("%d", &n))
{
int flag = 1;
ll ans = 0;
for(int i = 1; i <= n; i++)
{
scanf("%lld", &sum[i]);
if(flag)
{
if(sum[i] == 1)
ans++;
else
flag = 0;
}
}
if(flag != 1)
{
if(ans % 2)
cout << "L" << endl;
else
cout << "H" << endl;
}
else
{
if(ans % 2)
cout << "H" << endl;
else
cout << "L" << endl;
}
}
return 0;
}
/*
int n, m;
ll sum[maxn];
int fa[maxn];
int flag[maxn];
int find(int x)
{
if(x == fa[x])
return x;
else
return fa[x] = find(fa[x]);
}
int main()
{
while(~scanf("%d %d", &n, &m))
{
for(int i = 1; i <= n; i++)
{
fa[i] = i;
sum[i] = 0;
flag[i] = 0;
}
while(m--)
{
int u, v;
scanf("%d %d", &u, &v);
flag[u] = 1;
flag[v] = 1;
int fx = find(u), fy = find(v);
if(fx != fy)
fa[fx] = fy;
}
ll s = 0;
for(int i = 1; i <= n; i++)
{
if(flag[i] == 0)
continue;
sum[find(i)]++;
}
for(int i= 1; i <= n; i++)
s += sum[i];
sort(sum + 1, sum + 1 + n);
int l = 1;
for(int i = 1; i <= n; i++)
{
if(sum[i] != 0)
{
l = i;
break;
}
}
ll s1 = 0, s2;
ll ans;
for(int i = l; i <= n; i++)
{
s1 += sum[i];
if(s1 >= s / 2)
break;
}
s2 = s - s1;
if(s1 == s2)
ans = s1;
else if(s1 > s2)
ans = min(s1, max(s2 + sum[l], s1 - sum[l]));
else if(s1 < s2)
{
}
printf("%lld\n", ans);
}
return 0;
}*/