# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677246 | Mariabf | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 296 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 main(){
int n;
cin>>n;
vector<char>nums(n);
int maxim=0;
int minim=0;
int suma=0;
vector<vector<char>>g;
bool haveto=false;
for(int i=0; i<n; i++){
cin>>nums[i];
if(nums[i]=='+')suma++;
else if(nums[i]=='-'){
suma--;
if(i==0)maxim--;}
if(haveto){
if(nums[i]=='-'){
maxim--;
haveto=false;
}haveto=false;
}
if(suma>maxim){
maxim++;
haveto=true;
}
minim=min(suma, minim);
}if(haveto)maxim--;
g.resize(n, vector<char>(maxim-minim+1, '.'));
suma=0;
for(int i=0; i<n; i++){
if(nums[i]=='+'){
g[i][maxim-suma]='/';
suma++;
}
else if(nums[i]=='-'){
suma--;
g[i][maxim-suma]=char(92);
}else{
g[i][maxim-suma]='_';
}
}
for(int i=0; i<maxim-minim+1; i++){
for(int j=0; j<n; j++){
cout<<g[j][i];
}cout<<'\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |