SRM 473

登録時間に間に合いませんでした。
一応、div1の250だけ解いてみました。

#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

class SequenceOfCommands {
private:
	struct robot{
		int x;
		int y;
		int direct;
	};

	robot me;

	void step(char a,robot* rob){
		switch(a){
		case 'S':
			if(rob->direct==0){
				rob->x++;
			}else if(rob->direct==1){
				rob->y++;
			}else if(rob->direct==2){
				rob->x--;
			}else{
				rob->y--;
			}
			break;

		case 'R':
			rob->direct = (rob->direct+3)%4;
			break;

		case 'L':
			rob->direct = (rob->direct+1)%4;
			break;

		default:
			break;
		}
	}



	public: string whatHappens(vector<string> commands) {

		me.x=0;
		me.y=0;
		me.direct=0;

		for(int i=0; i<4; i++){
			for(unsigned int j=0; j<commands.size(); j++){
				for(unsigned int k=0; k<commands[j].size(); k++){
					step(commands[j][k],&me);
				}
			}
		}

		if(me.x==0 && me.y==0) return "bounded";
		else	return "unbounded";
	}

};