纯暴力。。。
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
int n;
int dx[4] = {0,1,0,-1},dy[4] = {1,0,-1,0};//urdl
int v[1010];
map<char,int> mp;
int dir[1010];
int sx[1010],sy[1010];
int nx[1010],ny[1010];
int main(int argc, char const *argv[])
{
cin>>n;
mp['U'] = 0;
mp['R'] = 1;
mp['D'] = 2;
mp['L'] = 3;
for(int i=1;i<=n;i++)
{
int x,y;
char ch;
cin>>x>>y>>v[i]>>ch;
dir[i] = mp[ch];
sx[i] = x;
sy[i] = y;
}
int maxn = 0;
int maxm = 0;
for(int t=0;t<=1000;t++)
{
for(int i=1;i<=n;i++)
{
nx[i] = sx[i] + dx[dir[i]]*t*v[i];
ny[i] = sy[i] + dy[dir[i]]*t*v[i];
}
map<int,int> mx;
map<int,int> my;
for(int i=1;i<=n;i++)
{
mx[nx[i]]++;
my[ny[i]]++;
}
for(auto o : mx)
{
if(o.second>maxn)
{
maxn = o.second;
maxm = o.first;
}
}
for(auto o : my)
{
if(o.second>maxn)
{
maxn = o.second;
maxm = o.first;
}
}
}
cout<<maxn<<endl;
system("pause");
return 0;
}