Submission #1177029

#TimeUsernameProblemLanguageResultExecution timeMemory
1177029JohanCrtanje (COCI20_crtanje)C++20
50 / 50
1 ms1352 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double const int MAX = 1e3 + 6; const int LOG = 25; const int inf = 1e18; const int mod = 1e9 + 7; const int block = 333; // mt19937 rng(chrono::steady_clock::now().time_since_epoch().count void _(){ int n, mx = -inf, mn = inf; string s; cin >> n >> s; vector < vector < char > > res(MAX, vector < char > (MAX, '.')); int x = 500, y = 1; for(int i = 0; i < s.size(); i++){ char c = s[i]; if(c == '+'){ if(i != 0){ if(res[x][y] == '/') x--, y++; else y++; } res[x][y] = '/'; } else if(c == '-'){ if(i != 0){ if(res[x][y] == 92 or res[x][y] == '_') x++, y++; else y++; } res[x][y] = 92; } else if(c == '='){ if(i != 0){ if(res[x][y] == 92) y++; else if(res[x][y] == '/') x--, y++; else if(res[x][y] == '_') y++; } res[x][y] = '_'; } } for(int i = 1; i <= 1000; i++){ for(int j = 1; j <= 1000; j++){ if(res[i][j] != '.') mn = min(mn, i), mx = max(mx, i); } } for(int i = mn; i <= mx; i++){ for(int j = 1; j <= s.size(); j++){ cout << res[i][j]; } cout << endl; } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; // cin >> t; while(t--) _(); }
#Verdict Execution timeMemoryGrader output
Fetching results...