# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
489669 | fuad27 | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 276 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int k(char c) {
if(c == '/')return 1;
if(c == '\\')return -1;
return 0;
}
int main () {
int n;
cin >> n;
string s;
cin >> s;
int MAX = 0, MIN = 0, curr = 0;
for(char i:s) {
if(i == '+')curr++;
else if(i == '-')curr--;
else {
MAX = max(MAX, curr+1);
}
MAX = max(MAX, curr);
MIN = min(MIN, curr);
}
char arr[MAX-MIN][n];
curr = MAX;
char c = '.';
for(int i = 0;i<n;i++) {
if(s[i] == '+')curr--;
if(s[i] == '+')c = '/';
else if(s[i] == '-')c='\\';
else {c='_';curr--;}
for(int j = 0;j<MAX-MIN;j++) {
if(j == curr)arr[j][i] = c;
else arr[j][i] = '.';
}
if(s[i] == '-')curr++;
else if(s[i] == '=')curr++;
}
for(int i = 0;i<MAX-MIN;i++) {
for(int j = 0;j<n;j++) {
cout << arr[i][j];
}
cout << endl;
}
if(MAX-MIN == 0) {
for(int i = 0;i<n;i++)cout<<'-';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |