#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<vector<char>> v(n, vector<char> (2*n+3));
int a = n+1, min = n+1, max = n+1;
char val;
for (int i = 0; i < n; i++){
cin >> val;
if (val == '='){
if (i > 0 && v[i-1][a] == '/') a++;
v[i][a] = '_';
if (a > max) max = a;
}
else if (val == '+'){
if (i > 0 && v[i-1][a] == '/') a++;
v[i][a] = '/';
if (a > max) max = a;
}
else{
if (i > 0 && v[i-1][a] == '\\') a--;
v[i][a] = '\\';
if (a < min) min = a;
}
}
for (int i = max; i >= min; i--){
for (int j = 0; j < n; j++){
if (v[j][i] == '/') cout << "/";
else if (v[j][i] == '\\') cout << "\\";
else if (v[j][i] == '_') cout << "_";
else cout << ".";
}
cout << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |