| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 677249 | Ariadna | Crtanje (COCI20_crtanje) | C++14 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector < pair < int, int > > worth(n + 1, {0, 0});
int maximum = 0, minimum = 0;
for (int i = 1; i <= n; ++i) {
char c;
cin >> c;
if (c == '+') {
worth[i] = make_pair(worth[i - 1].first + 1, 1);
} else if (c == '-') {
worth[i] = make_pair(worth[i - 1].first - 1, -1);
} else {
worth[i] = make_pair(worth[i - 1].first, 0);
}
maximum = max(maximum, worth[i].first);
minimum = min(minimum, worth[i].first);
}
int h = maximum - minimum;
for (int i = 0; i < h; ++i) {
int p = maximum - i;
for (int j = 1; j <= n; ++j) {
// posición actual = maximum - i
int a = worth[j].second;
if (a == 1) { // +
if (p == worth[j].first)
cout << '/';
else cout << '.';
} else if (a == 0) { // =
if (worth[j - 1].second == 1) {
if (p == worth[j].first + 1) {
cout << '_';
++worth[j].first;
} else cout << '.';
} else if (worth[j - 1].second == -1) {
if (p == worth[j].first + 1) {
cout << '_';
++worth[j].first;
} else cout << '.';
} else {
if (p == worth[j - 1].first)
cout << '_';
else
cout << '.';
}
} else { // -
if (p == worth[j].first + 1)
cout << '\\';
else cout << '.';
}
}
cout << '\n';
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
