| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 674987 | jovian_aap | Kemija (COCI22_kemija) | C++17 | 1 ms | 324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
void balance(string s) {
vector<int> rctn(100), pdct(100);
bool a = false;
int m = 1;
char l = '0';
for (int i = 0; i < s.size(); i++) {
if (s[i] == '>' || s[i] == '-') {
a = true;
m = 1;
l = '0';
} else if (s[i] == '+') {
m = 1;
l = '0';
} else if (isdigit(s[i])) {
if (l == '0') {
m = s[i] - l;
} else {
if (a) {
pdct[s[i-1] - 'A'] += m*(s[i]-'1');
} else {
rctn[s[i-1] - 'A'] += m*(s[i]-'1');
}
}
} else {
if (a) {
pdct[s[i] - 'A'] += m;
} else {
rctn[s[i] - 'A'] += m;
}
l = s[i];
}
}
if (rctn == pdct) {
cout << "DA" << endl;
} else {
cout << "NE" << endl;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
balance(s);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
