Skip to content

Instantly share code, notes, and snippets.

Created August 9, 2013 03:32
Show Gist options
  • Select an option

  • Save anonymous/6190968 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/6190968 to your computer and use it in GitHub Desktop.
SPOJ 6772 [HC]
#include <iostream>
#include <sstream>
#include <bitset>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <numeric>
#include <list>
#define FOR(i,A) for(typeof (A).begin() i = (A).begin() ; i != (A).end() ; i++)
#define mp make_pair
#define debug( x ) cout << #x << " = " << x << endl
#define clr(v,x) memset( v, x , sizeof v )
#define all(x) (x).begin() , (x).end()
#define rall(x) (x).rbegin() , (x).rend()
#define ones(x) __builtin_popcount( x )
#define f(i,a,b) for(int i = a ; i < b ; i++)
#define fd(i,a,b) for(int i = a ; i >= b ; i--)
#define PI acos( -1.0 )
#define EPS 1E-9
#define TAM 100010
using namespace std;
typedef pair<int,int> ii ;
typedef long long ll ;
typedef long double ld ;
typedef pair<int,ii> pii ;
int n ;
char v[ TAM ][ 10 ] ;
int main(){
int test ;
scanf("%d" , &test ) ;
while( test-- ){
scanf("%d" , &n ) ;
f( i , 0 , n ) scanf("%s" , v[ i ] ) ;
if( n == 1 ){
printf("%s\n" , v[ 0 ] ) ;
continue ;
}
char R = ( v[ 0 ][ 0 ] != v[ 1 ][ 0 ] ? 'l' : 'h' ) ;
f( i , 2 , n ) R = ( R != v[ i ][ 0 ] ? 'l' : 'h' ) ;
printf("%s\n" , R == 'l' ? "lxh" : "hhb" ) ;
}
return 0 ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment