# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
469533 | ahmeteren | Crtanje (COCI20_crtanje) | C++14 | 1 ms | 332 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;
char grid[1005][1005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
string str;
cin >> n >> str;
int cur = 0, mx = INT_MIN, mn = INT_MAX;
for(int i = 0; i < n; i++)
{
if(str[i] == '+')
{
grid[cur + n][i] = '/';
mn = min(mn, cur + n);
mx = max(mx, cur + n);
cur++;
}
else if(str[i] == '-')
{
cur--;
grid[cur + n][i] = '\\';
mn = min(mn, cur + n);
mx = max(mx, cur + n);
}
else
{
grid[cur + n][i] = '_';
mn = min(mn, cur + n);
mx = max(mx, cur + n);
}
}
for(int i = mx; i >= mn; i--)
{
for(int j = 0; j < n; j++)
{
if(!grid[i][j])
cout << '.';
else
cout << grid[i][j];
}
cout << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |