Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: mantaggez
Problemset: นักเดินทาง
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-01 15:09:53
#include <bits/stdc++.h>
using namespace std;
const int nx = 200;
int x = 100, y = 100, mxx, mxy, mnx, mny;
char alp = 'a';
string s;
vector<vector<char>> grid(nx, vector<char> (nx, '.'));
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin >> s;
mxx = mnx = x;
mxy = mny = y;
bool f = true;
for(char& c : s) {
if(f) {
f = false;
continue;
}
if(alp > 'z') alp = 'A';
grid[x][y] = alp;
alp++;
if(c == 'D') x++;
if(c == 'U') x--;
if(c == 'L') y--;
if(c == 'R') y++;
mxx = max(mxx, x);
mxy = max(mxy, y);
mnx = min(mnx, x);
mny = min(mny, y);
}
grid[x][y] = alp;
for(int i=mnx;i<=mxx;i++) {
for(int j=mny;j<=mxy;j++) {
cout << grid[i][j];
}
cout << '\n';
}
return 0;
}