# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
644924 | Iwanttobreakfree | Kemija (COCI22_kemija) | C++17 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
int main() {
string s;
int n;
cin >> n;
while (n--) {
cin >> s;
bool sec = false;
char last = '0';
int mult = 1;
vector<int> num (26), num2 (26);
for (int i = 0; i < s.size(); ++i) {
if (s[i] == '+') {
last = '0';
mult = 1;
}
else if (s[i] == '>') {
sec = true;
last = '0';
mult = 1;
}
else if ('0' <= s[i] and s[i] <= '9') {
if (last == '0') mult = s[i]-'0';
else {
if (sec) num2[s[i-1]-'A']+=mult*(s[i]-'1');
else num[s[i-1]-'A']+=mult*(s[i]-'1');
//cout << << '\n';
}
}
else if ('A'<=s[i] and s[i]<='Z'){
if (sec) num2[s[i]-'A'] += mult;
else num[s[i]-'A']+=mult;
last = s[i];
}
}
//for (int i = 0; i < 26; ++i) cout << num[i] << num2[i] << '\n';
if (num == num2) cout << "DA\n";
else cout << "NE\n";
}
}
Compilation message (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... |