Submission #332549

# Submission time Handle Problem Language Result Execution time Memory
332549 2020-12-02T20:34:35 Z morato Crtanje (COCI20_crtanje) C++17
50 / 50
1 ms 364 KB
/**
 *    author:  morato
 *    created: 02.12.2020 16:45:53
**/
#include <bits/stdc++.h>

using namespace std;

char m[205][205];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  string s; cin >> s;
  int cur = 100, prev = 100;
  int menor = 201, maior = 0;
  for (int i = 0; i <= 200; i++) {
    for (int j = 0; j <= 200; j++) {
      m[i][j] = '.';
    }
  }
  char prevc = '.';
  for (int i = 0; i < n; i++) {
    if ((s[i] == '=' && prevc == '-') || (s[i] == '-' && prevc == '+') || (s[i] == '+' && prevc == '-')) cur = prev;
    if (s[i] == '-' && prevc == '=') cur++;
    menor = min(menor, cur);
    maior = max(maior, cur);
    m[cur][i] = (s[i] == '+' ? '/' : s[i] == '-' ? '\\' : '_');
    prev = cur;
    prevc = s[i];
    if (s[i] == '-') cur++;
    if (s[i] == '+') cur--;
  }
  for (int i = menor; i <= maior; i++) {
    for (int j = 0; j < n; j++) {
      cout << m[i][j];
    }
    cout << '\n';
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct