# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
854437 | vjudge1 | Crtanje (COCI20_crtanje) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define endl "\n"
#define all(x) x.begin(), x.end()
#define ll long long
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007
#define lim 200005
using namespace std;
void solve(){
int n; cin >> n;
string s; cin >> s;
int mini=0, maxi=0, cur=0;
for(int i=0; i<n; i++){
char c=s[i];
if(i!=n-1){
if(s[i]=='+' && s[i+1]!='-') cur--;
if(s[i]=='-' && s[i+1]=='-') cur++;
}
mini = max(-cur, mini);
maxi = max(cur, maxi);
}
cerr << mini spc maxi << endl;
char arr[mini+maxi+1][n];
for(int i=0; i<mini+maxi+1; i++) for(int j=0; j<n; j++) arr[i][j]='.';
cur=mini;
for(int i=0; i<n; i++){
if(s[i]=='='){
arr[cur][i]='_';
if(i!=n-1 && s[i+1]=='-')cur++;
}
else if(s[i]=='+'){
arr[cur][i]='/';
if(i!=n-1 && s[i+1]!='-')cur--;
}
else{
arr[cur][i]='\\';
if(i!=n-1 && s[i+1]=='-')cur++;
}
}
for(int i=0; i<mini+maxi+1; i++){
for(int j=0; j<n; j++) cout << arr[i][j];
cout << endl;
}
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
#ifdef Local
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
ll t=1;
//cin >> t;
while(t--) solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |