#include<iostream> #include<vector> #include<algorithm> #include<iomanip> #include<string> #include<cmath> #include<unordered_map> using namespace std; int main() { int n; while (cin >> n) { int x = 0, y = 0; for (int i = 0; i < n; i++) { string str; cin >> str; if (str[0] == 'L') x -= atoi(str.substr(1, str.size() - 1).c_str()); if(str[0] == 'R') x += atoi(str.substr(1, str.size() - 1).c_str()); if(str[0] == 'F') y -= atoi(str.substr(1, str.size() - 1).c_str()); if(str[0] == 'B') y += atoi(str.substr(1, str.size() - 1).c_str()); } int endx, endy; cin >> endx >> endy; if (x == endx && y == endy) cout << "MEME IS SO LUCKY" << endl; else cout << "GPS ERROR" << endl; } } |
Double click to view unformatted code.