# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
328133 | forza_viola | Crtanje (COCI20_crtanje) | C++14 | 2 ms | 620 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 <GOD>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define len length
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define frei freopen("input.txt","r",stdin)
#define freo freopen("output.txt","w",stdout)
const ll inf=1e18;
const ll mod=1e9+7;
const ll maxn=500+10,maxl=2e6+10;
char mat[maxn][maxn];
ll n;
string s;
ll mx=-inf,mn=inf;
int main(){
FAST_IO;
for(int i=0;i<maxn;i++){
for(int j=0;j<maxn;j++){
mat[i][j]='.';
}
}
cin>>n>>s;
ll stock=250;
ll pre=250;
ll st=0;
for(int i=0;i<s.len();i++){
if(s[i]=='+'){
stock++;
mat[stock-1][i]='/';
pre=stock-1;
st=1;
}else if(s[i]=='-'){
stock--;
mat[stock][i]=(char)92;
pre=stock;
st=-1;
}else{
if(st==1){
mat[pre+1][i]='_';
pre++;
}else if(st==-1){
mat[pre][i]='_';
}else{
mat[pre][i]='_';
}
st=0;
}
}
for(int i=0;i<maxn;i++){
for(int j=0;j<maxn;j++){
if(mat[i][j]=='/'||mat[i][j]=='_'||mat[i][j]==(char)92){
mn=min(mn,i*1ll);
mx=max(mx,i*1ll);
}
}
}
for(int i=mx;i>=mn;i--){
for(int j=0;j<s.len();j++){
cout<<mat[i][j];
}cout<<endl;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |