# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
835326 | 2023-08-23T13:07:38 Z | EntityPlantt | Zamjena (COCI18_zamjena) | C++14 | 6 ms | 4580 KB |
#include <iostream> #include <map> #include <set> using namespace std; int n, i; string arr[50000], x; map <string, int> m; map <string, set <string>> eq; inline const int v(const string &k) { return isdigit(k[0]) ? stoi(k) : m[k]; } inline const int s(const string &k, const int &i) { m[k] = i; string e; while (!eq[k].empty()) { e = *prev(eq[k].end()); eq[k].erase(prev(eq[k].end())); s(e, i); } } int main() { ios::sync_with_stdio(); cin.tie(0); cout.tie(0); cin >> n; for (i = 0; i < n; i++) cin >> arr[i]; for (i = 0; i < n; i++) { cin >> x; if (arr[i] == x); else if (v(arr[i]) && v(x)) { if (v(arr[i]) != v(x)) { cout << "NE"; return 0; } } else if (v(arr[i])) s(x, v(arr[i])); else if (v(x)) s(arr[i], v(x)); else { eq[arr[i]].insert(x); eq[x].insert(arr[i]); } } cout << "DA"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 3668 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 3668 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 3668 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 4172 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 4580 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |