here is my c++ code ,but it just pass a few test, most of the failed tests is about the late time , i think the range should be revised , but i dont nknow how to develop this code
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
int main()
{
int W; // width of the building.
int H; // height of the building.
cin >> W >> H; cin.ignore();
int N; // maximum number of turns before game over.
cin >> N; cin.ignore();
int X0;
int Y0;
int first_x =0 ;
int first_y = 0;
int last_x = W;
int last_y = H;
//the batman start location.
cin >> X0 >> Y0; cin.ignore();
// game loop
while (1) {
string bombDir; // the direction of the bombs from batman's current location (U, UR, R, DR, D, DL, L or UL)
cin >> bombDir; cin.ignore();
// Write an action using cout. DON'T FORGET THE "<< endl"
if(bombDir[0] == 'U')
{
last_y --;
}
else if(bombDir[0] == 'D')
{
first_y ++;
}
if(bombDir[1] =='L')
{
last_x--;
}
else if(bombDir[1] == 'R')
{
first_x ++;
}
X0 = first_x + (last_x-first_x)/2;
Y0 = first_y + (last_y - first_y)/2;
cout <<X0<<" "<<Y0<< endl;
}
return 0;
}