답안 #677252

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
677252 2023-01-02T16:26:08 Z Truitadepatates Crtanje (COCI20_crtanje) C++14
50 / 50
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<char>> v(n, vector<char> (2*n+1, '.'));
  int a = n+1, min = -1, max = 0;
  char val;
  for (int i = 0; i < n; i++){
    cin >> val;
    if (val == '='){
      v[i][a] = '_';
    }
    else if (val == '+'){
      v[i][a] = '/';
      a++;
    }
    else{
      a--;
      v[i][a] = '\\';
    }
  }
  for (int i = 0; i <= 2*n; i++){
    for(int j = 0; j < n; j++){
      if (v[j][i] != '.'){
        if (min == -1) min = i;
        max = i;
        break;
      }
    }
  }
  for (int i = max; i >= min; i--){
    for (int j = 0; j < n; j++){
      if (v[j][i] == '/') cout << "/";
      else if (v[j][i] == '\\') cout << "\\";
      else if (v[j][i] == '_') cout << "_";
      else cout << ".";
    }
    cout << "\n";
  }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct