답안 #332545

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
332545 2020-12-02T20:24:00 Z souvenir_vayne Crtanje (COCI20_crtanje) C++14
0 / 50
1 ms 364 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <chrono>
#define pb push_back
#define INF 0x3f3f3f3f
//#define LINF 0x3f3f3f3f3f3f3f3f
//#define endl '\n'
#define ll long long
#define f first
#define fin cin
#define fout cout
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
#define all(x) x.begin(), x.end()
#define left vadia
#define lb lower_bound
#define right puta
using namespace std;
using namespace __gnu_pbds;
void setIO(string s) {
  ios_base::sync_with_stdio(0); cin.tie(0);
  freopen((s+".in").c_str(),"r",stdin);
  freopen((s+".out").c_str(),"w",stdout);
}
typedef pair<ll, ll> pii;
typedef vector<vector<char>> mat;
typedef pair<int, string> pis;
const ll mod = 1e9+7;
typedef vector<int> vi;
typedef pair<int, pair<int, int>> piii;

char m[105][105];

int32_t main() {

    int n;
    cin >> n;

    string v;
    cin >> v;

    int big = 0, now = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] == '-') now--;
        big = max(now, big);
        if(v[i] == '+') now++;
    }

    int x = big, mx = 0;
    debug(big);

    memset(m, '.', sizeof m);
    for(int i = 0; i < n; i++) {

        if(i && v[i] == '-') x++;
        mx = max(mx, x);
        m[x][i] = (v[i] == '-' ? '\\' : (v[i] == '+' ? '/' : '_'));
        if(v[i] == '+') x--;


    }
    for(int i = 0; i <= mx; cout << endl, i++)
        for(int j = 0; j < n; j++)
            cout << m[i][j];


}

Compilation message

crtanje.cpp: In function 'void setIO(std::string)':
crtanje.cpp:26:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   26 |   freopen((s+".in").c_str(),"r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
crtanje.cpp:27:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   27 |   freopen((s+".out").c_str(),"w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Incorrect 1 ms 364 KB Output isn't correct