Submission #496100

#TimeUsernameProblemLanguageResultExecution timeMemory
496100AlperenTCrtanje (COCI20_crtanje)C++17
40 / 50
1 ms332 KiB
#include <bits/stdc++.h> using namespace std; const int N = 100 + 5; int n, arr[N], mn, mx; vector<char> rows[N]; string str; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> n; cin >> str; str = '$' + str; for(int i = 1; i <= n; i++){ arr[i] = arr[i - 1]; if(str[i] == '+') arr[i]++; else if(str[i] == '-') arr[i]--; } mn = *min_element(arr, arr + n + 1), mx = *max_element(arr, arr + n + 1); for(int i = 1; i <= n; i++) arr[i] += abs(mn); mx += abs(mn), mn += abs(mn); for(int col = 1; col <= n; col++){ if(str[col] == '+'){ for(int row = mn + 1; row <= mx; row++){ if(row == arr[col]) rows[row].push_back('/'); else rows[row].push_back('.'); } } else if(str[col] == '-'){ for(int row = mn + 1; row <= mx; row++){ if(row == arr[col] + 1) rows[row].push_back('\\'); else rows[row].push_back('.'); } } else if(str[col] == '='){ for(int row = mn + 1; row <= mx; row++){ if(row == arr[col] + 1) rows[row].push_back('_'); else rows[row].push_back('.'); } } } for(int i = mx; i >= mn + 1; i--){ for(auto j : rows[i]) cout << j; cout << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...