Submission #1176913

#TimeUsernameProblemLanguageResultExecution timeMemory
1176913ElayV13Crtanje (COCI20_crtanje)C++20
20 / 50
2 ms1352 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int INF = 1e18; signed main(){ int n; cin >> n; string s; cin >> s; vector < vector < char > > res(1001 , vector < char > (1001 , '.')); int x = 500 , y = 0; char last = '?'; for(int i = 0;i < s.size();i++) { if(s[i] == '+'){ x--; y++; res[x][y] = '/'; } else if(s[i] == '='){ if(last == '+'){ x--; y++; } else{ y++; } res[x][y] = '_'; } else{ if(last == '+'){ y++; } else{ x++; y++; } res[x][y] = 92; } last = s[i]; } int mnX = INF , mxX = -INF , mxY = INF , mnY = -INF; for(int i = 1;i <= 1000;i++){ for(int j = 1;j <= 1000;j++){ if(res[i][j] != '.'){ mxX = max(mxX , i); mnX = min(mnX , i); mxY = max(mxY , j); mnY = min(mnY , j); } } } for(int i = 1;i <= 1000;i++){ bool f = 0; for(int j = 1;j <= n;j++){ if(i <= mxX && i >= mnX && j <= mxY && j >= mnY){ cout << res[i][j]; f = 1; } } if(f) cout << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...