#include #include using namespace std; /* void solve(){ string n, a, b; cin >> n >> a >> b; long n_ = stol(n); long a_ = stol(a); long b_ = stol(b); if (a_ * b_ != n_) { cout << "NO" << endl; return; } const int n2 = (int)(n.length()) / 2; if ((a.length() != n2 && b.length() != n2) || (n.length() % 2) == 1){ cout << "NO" << endl; return; } map word; for (auto c: n){ word[c]++; } if (a[a.length() - 1] == '0' && b[b.length() - 1] == '0'){ cout << "NO" << endl; return; } for (auto c : a){ if (word.find(c) == word.end()){ cout << "NO" << endl; return; } auto cnt = word[c]; if (cnt == 0) { cout << "NO" << endl; return; } word[c]--; } for (auto c: b){ if (word.find(c) == word.end()){ cout << "NO" << endl; return; } auto cnt = word[c]; if (cnt == 0) { cout << "NO" << endl; return; } word[c]--; } for (auto item : word){ if (item.second != 0){ cout << "NO" << endl; return; } } cout << "YES" << endl; } int main() { int t; cin >> t; while (t--) solve(); return EXIT_SUCCESS; } */ #include #include using namespace std; struct line{ int position; int speed; char direction; int length; }; void solve(){ int n, m, t; cin >> n >> m >> t; vector lines(m); vector> output(n); for (auto& line: lines) { cin >> line.position >> line.speed >> line.direction >> line.length; } for (int trackNumber = 0; trackNumber < m; trackNumber++) { auto currentTrain = lines[trackNumber]; int shift = currentTrain.speed * t; int newPositionStart = currentTrain.position - shift; if (currentTrain.direction == 'R') { newPositionStart = currentTrain.position + shift; } int newPositionEnd = newPositionStart + currentTrain.length; for (int trackPosition = 0; trackPosition < n; trackPosition++){ if (newPositionStart <= trackPosition && trackPosition < newPositionEnd) { if (newPositionStart == trackPosition && currentTrain.direction == 'L') { cout << '!'; } else if (newPositionEnd-1 == trackPosition && currentTrain.direction == 'R') { cout << '!'; } else { cout << '#'; } } else { cout << '='; } } cout << '\n'; } } int main() { solve(); return EXIT_SUCCESS; }