# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472305 | 2021-09-13T11:25:37 Z | Mr_OK_Man | Zamjena (COCI18_zamjena) | C++17 | 303 ms | 15540 KB |
#include <bits/stdc++.h> using namespace std; long long c=0,n; long long r=0; string a[50001]={},b[50001]={}; map<string,vector<string>>mp; map<string,vector<string>>mp1; map<string,bool>v; void dfs(string x) { if(isdigit(x[0])) { r++; } v[x]=1; for(auto i:mp[x]) { if(v[i]==0) { dfs(i); } } } int main() { // cout << "Hello world!" << endl; cin>>n; long long as=0,a1s=0,bs=0,b1s=0; for(int i=0;i<n;i++) { string s; cin>>s; long long r=0; a[i]=s; } for(int i=0;i<n;i++) { string s; cin>>s; b[i]=s; mp[a[i]].push_back(s); mp[s].push_back(a[i]); } long long q=0; for(int i=0;i<n;i++) { r=0; if(isdigit(a[i][0])&&isdigit(b[i][0])) { if(a[i]!=b[i]) { q=1; break; } } else { if(isdigit(a[i][0])) { dfs(b[i]); } else { dfs(a[i]); } if(r>1) { q=1; break; } } } if(q==1) { cout<<"NE"<<endl; } else { cout<<"DA"<<endl; } //sort(a,a+as); //sort(a1,a1+a1s); //sort(b,b+bs); //sort(b1,b1+b1s); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3404 KB | Output is correct |
2 | Correct | 2 ms | 3404 KB | Output is correct |
3 | Correct | 2 ms | 3404 KB | Output is correct |
4 | Correct | 2 ms | 3404 KB | Output is correct |
5 | Correct | 2 ms | 3404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3404 KB | Output is correct |
2 | Correct | 2 ms | 3404 KB | Output is correct |
3 | Correct | 2 ms | 3404 KB | Output is correct |
4 | Correct | 2 ms | 3404 KB | Output is correct |
5 | Correct | 2 ms | 3404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3404 KB | Output is correct |
2 | Correct | 2 ms | 3404 KB | Output is correct |
3 | Correct | 2 ms | 3404 KB | Output is correct |
4 | Correct | 2 ms | 3420 KB | Output is correct |
5 | Correct | 2 ms | 3404 KB | Output is correct |
6 | Correct | 2 ms | 3404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 3640 KB | Output is correct |
2 | Correct | 5 ms | 3532 KB | Output is correct |
3 | Correct | 6 ms | 3916 KB | Output is correct |
4 | Correct | 7 ms | 4044 KB | Output is correct |
5 | Correct | 11 ms | 4124 KB | Output is correct |
6 | Correct | 9 ms | 3980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 5580 KB | Output is correct |
2 | Correct | 79 ms | 7672 KB | Output is correct |
3 | Correct | 49 ms | 8644 KB | Output is correct |
4 | Correct | 82 ms | 10564 KB | Output is correct |
5 | Correct | 303 ms | 15540 KB | Output is correct |
6 | Correct | 242 ms | 11716 KB | Output is correct |