#include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr double EPS = 1e-9; int cells; void write_cell(char* view, ll position, char symbol) { if (position < 0 || position >= cells) { return; } view[position] = symbol; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int tracks, time; cin >> cells >> tracks >> time; char view[cells + 1]; for (int track = 0; track < tracks; track++) { view[cells] = '\0'; for (int i = 0; i < cells; ++i) { view[i] = '='; } ll position, speed; char direction; int length; cin >> position >> speed >> direction >> length; int dir = direction == 'L' ? -1 : 1; ll headPosition = direction == 'L' ? position : position + length - 1; ll headUpdated = headPosition + speed * time * dir; write_cell(view, headUpdated, '!'); for (int i = 1; i < length; i++) { write_cell(view, headUpdated + i * -dir, '#'); } cout << view << '\n'; } return 0; }