답안 #922340

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
922340 2024-02-05T12:25:10 Z Shayan86 Crtanje (COCI20_crtanje) C++14
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
// Ofast, O0, O1, O2, O3, unroll-loops, fast-math, trapv

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define Mp          make_pair
#define sep         ' '
#define endl        '\n'
#define F	        first
#define S	        second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define kill(res)	cout << res << '\n', exit(0);
#define set_dec(x)	cout << fixed << setprecision(x);
#define fast_io     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io     freopen("input.txt", "r", stdin) ; freopen("output.txt", "w", stdout);

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N = 200 + 20;
const ll Mod = 1e9 + 7;

ll n;

string s;
char a[N][N];

int main(){
    fast_io;

    for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) a[i][j] = '.';

    cin >> n >> s;

    int cur = 110;
    int mn = N, mx = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == '+'){
            a[i][cur++] = '/';
            mn = min(mn, cur-1); mx = max(mx, cur-1);
        }
        else if(s[i] == '-'){
            a[i][--cur] = '\\';
            mn = min(mn, cur); mx = max(mx, cur);
        }
        else{
            a[i][cur] = '_';
            mn = min(mn, cur); mx = max(mx, cur);
        }
    }

    for(int i = mx; i >= mn; i--){
        for(int j = 0; j < n; j++){
            cout << a[j][i];
        }
        cout << endl;
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct