# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95550 | kimcoding | Zamjena (COCI18_zamjena) | C++17 | 182 ms | 9100 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 <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;
int n;
map <string, string> m;
vector <string> a, b;
bool is_number(string s) {
return (s[0] >= '0' && s[0] <= '9');
}
string find(string s) {
if (!m.count(s)) return s;
if (is_number(s)) return s;
return m[s] = find(m[s]);
}
bool cmp(string x, string y){
x = find(x);
y = find(y);
if (x == y) return true;
bool nx = is_number(x), ny = is_number(y);
if (nx && ny) return x == y;
else if (nx && !ny) m[y] = x;
else if (!nx && ny) m[x] = y;
else m[x] = y;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |