Submission #472305

#TimeUsernameProblemLanguageResultExecution timeMemory
472305Mr_OK_ManZamjena (COCI18_zamjena)C++17
70 / 70
303 ms15540 KiB
#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 (stderr)

zamjena.cpp: In function 'int main()':
zamjena.cpp:37:18: warning: unused variable 'r' [-Wunused-variable]
   37 |        long long r=0;
      |                  ^
zamjena.cpp:32:14: warning: unused variable 'as' [-Wunused-variable]
   32 |    long long as=0,a1s=0,bs=0,b1s=0;
      |              ^~
zamjena.cpp:32:19: warning: unused variable 'a1s' [-Wunused-variable]
   32 |    long long as=0,a1s=0,bs=0,b1s=0;
      |                   ^~~
zamjena.cpp:32:25: warning: unused variable 'bs' [-Wunused-variable]
   32 |    long long as=0,a1s=0,bs=0,b1s=0;
      |                         ^~
zamjena.cpp:32:30: warning: unused variable 'b1s' [-Wunused-variable]
   32 |    long long as=0,a1s=0,bs=0,b1s=0;
      |                              ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...