# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94539 | 2019-01-20T05:11:44 Z | YamiDust | Zamjena (COCI18_zamjena) | C++14 | 61 ms | 4692 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector < string > S(50010),T(50010); map <string , string > parent; string busca (string A) { if (parent[A]=="" || parent[A]==A) { parent[A]=A; return parent[A]; } parent[A] = busca(parent[A]); return parent[A]; } bool NUM (string K) { return (K[0]>='0' && K[0]<='9'); } bool comp (string A, string B){ //cout << "-----------\n" << A << " " << B << endl; if (A==B) { return true; } if (NUM(A) && NUM(B)) { return false; } string p1=busca(A); string p2=busca(B); //cout << p1 << " " << p2 << endl; if (NUM(p2) && NUM(A)) { if (p2!=A) { return false; } else { return true; } } if (p1!=p2) { parent[p2]=p1; } return true; } int main () { int N; scanf("%d",&N); vector < string > S(N+1),T(N+1); for (int i=0;i<N;i++) { cin >> S[i]; } for (int i=0;i<N;i++) { cin >> T[i]; } for (int i=0;i<N;i++){ if (!comp(min(S[i],T[i]),max(S[i],T[i]))) { printf("NE\n"); return 0; } } printf("DA\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3448 KB | Output is correct |
2 | Correct | 3 ms | 3448 KB | Output is correct |
3 | Correct | 4 ms | 3448 KB | Output is correct |
4 | Correct | 5 ms | 3448 KB | Output is correct |
5 | Correct | 4 ms | 3448 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3448 KB | Output is correct |
2 | Correct | 4 ms | 3448 KB | Output is correct |
3 | Correct | 4 ms | 3448 KB | Output is correct |
4 | Correct | 4 ms | 3448 KB | Output is correct |
5 | Correct | 4 ms | 3448 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3448 KB | Output is correct |
2 | Correct | 4 ms | 3448 KB | Output is correct |
3 | Correct | 4 ms | 3444 KB | Output is correct |
4 | Correct | 4 ms | 3448 KB | Output is correct |
5 | Correct | 4 ms | 3448 KB | Output is correct |
6 | Incorrect | 4 ms | 3452 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 3576 KB | Output is correct |
2 | Correct | 7 ms | 3576 KB | Output is correct |
3 | Incorrect | 15 ms | 3832 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 61 ms | 4692 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |