Submission #779069

#TimeUsernameProblemLanguageResultExecution timeMemory
779069vjudge1Zamjena (COCI18_zamjena)C++17
70 / 70
92 ms9868 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define faster ios_base::sync_with_stdio(false);cin.tie(NULL); #define OYY 1000000005 #define mod 998244353 map <string,int> mp; bool vis[50005]; int tut=0; vector <int> v; vector <int> vt[50005]; inline void dfs(int node){ vis[node]=1; for(int i=0;i<vt[node].size();i++){ if(!vis[vt[node][i]])dfs(vt[node][i]); } } int32_t main(){ faster memset(vis,0,sizeof(vis)); int n;cin>>n; string dizi[n],dizi1[n]; for(int i=0;i<n;i++){ cin>>dizi[i]; if(!mp.count(dizi[i])){ mp[dizi[i]]=tut; tut++; } } for(int i=0;i<n;i++){ cin>>dizi1[i]; if(!mp.count(dizi1[i])){ mp[dizi1[i]]=tut; tut++; } } for(int i=0;i<n;i++){ vt[mp[dizi[i]]].push_back(mp[dizi1[i]]); vt[mp[dizi1[i]]].push_back(mp[dizi[i]]); } map<string,int> ::iterator it=mp.begin(); while(it!=mp.end()){ string su=it->first; if(su[0]>='0' && su[0]<='9'){ v.push_back(it->second); } it++; } bool stop=true; for(int i=0;i<v.size() && stop;i++){ if(!vis[v[i]])dfs(v[i]); else stop=false; } if(stop)cout<<"DA"<<'\n'; else cout<<"NE"<<'\n'; return 0; }

Compilation message (stderr)

zamjena.cpp: In function 'void dfs(long long int)':
zamjena.cpp:15:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<vt[node].size();i++){
      |                 ~^~~~~~~~~~~~~~~~
zamjena.cpp: In function 'int32_t main()':
zamjena.cpp:52:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     for(int i=0;i<v.size() && stop;i++){
      |                 ~^~~~~~~~~
#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...