# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1003201 | 2024-06-20T07:45:31 Z | ulianamalanyak | Kemija (COCI22_kemija) | C++14 | 0 ms | 348 KB |
#include "bits/stdc++.h" using namespace std; #define endl '\n' #define INF 1000000000000 typedef int ll; const int DIM=1e3+7; ll n,m; string s; map<char,ll> m1,m2; int main() { freopen ("input.txt","r",stdin); freopen ("output.txt","w",stdout); cin >> m; while(m--) { cin >> s; m1.clear(); m2.clear(); n=s.size(); bool fl=0; for (int i=0;i<n;i++) { ll mult; if (s[i]>='0'&&s[i]<='9') { mult=s[i]-'0'; i++; } else mult=1; while(i<n&&s[i]!='+'&&s[i]!='-') { //cout << s[i] << fl << endl; char c=s[i]; ll mult1; if (i+1<n&&s[i+1]>='0'&&s[i+1]<='9') { mult1=s[i+1]-'0'; i++; } else mult1=1; ll kilk=mult*mult1; if (fl) { m2[c]+=kilk; //cout << m2[c] << endl; } else { m1[c]+=kilk; //cout << m1[c] << endl; } i++; } if (i>=n) continue; if (s[i]=='+') { continue; } else if (s[i]=='-') { i++; fl=1; } else i++; } if (m1.size()!=m2.size()) cout << "NE" << endl; else { bool ff=0; for (auto x:m1) { if (x.second!=m2[x.first]) { cout << "NE" << endl; ff=1; break; } } if (ff==0) cout << "DA" << endl; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |