# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334596 | GioChkhaidze | Crtanje (COCI20_crtanje) | C++14 | 1 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using namespace std;
const int N=111;
int n,t[N];
string s;
char C[N][N];
main () {
ios::sync_with_stdio(false);
cin.tie(NULL),cout.tie(NULL);
cin>>n;
cin>>s;
s="@"+s;
int Tmax=0,Tmin=0;
for (int i=1; i<=n; i++) {
if (s[i]=='+')
t[i]=t[i-1]+1;
else
if (s[i]=='-')
t[i]=t[i-1]-1;
else
if (s[i]=='=')
t[i]=t[i-1];
Tmax=max(Tmax,t[i]);
Tmin=min(Tmin,t[i]);
}
int ans=0;
for (int i=Tmax; i>=Tmin; i--)
for (int j=1; j<=n; j++) {
if (s[j]=='=' && t[j]==i) C[i][j]='_',ans++;
else
if (s[j]=='+' && t[j-1]==i) C[i][j]='/',ans++;
else
if (s[j]=='-' && t[j]==i) C[i][j]=char(92),ans++;
else C[i][j]='.';
}
for (int i=Tmax; i>=Tmin; i--) {
bool bo=false;
for (int j=1; j<=n; j++)
if (C[i][j]!='.') bo=true;
if (!bo) continue;
for (int j=1; j<=n; j++)
cout<<C[i][j];
cout<<"\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |