Submission #464634

#TimeUsernameProblemLanguageResultExecution timeMemory
464634aihayZamjena (COCI18_zamjena)C++14
70 / 70
266 ms44208 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> using namespace std; typedef int in; #define int long long #define f first #define s second #define pb push_back #define pp push #define double long double #define ceil(x,y) (x/y)+(x%y!=0)*((double)(1.0*x/y)<0?0:1) #define floor(x,y) (x/y)+(x%y!=0)*((double)(1.0a*x/y)<0?-1:0) const int MAX=1e7; const int MOD=1e9+7; const int MAAX=1e18; string arr[500010],arr2[500010]; map<string,vector<string> >mp; map<string,int> vis; set<string> fun(string idx){ set<string> ans; if(vis[idx]) return ans; vis[idx]=1; for(int i=0;i<mp[idx].size()&&ans.size()<2;i++){ set<string>x=fun(mp[idx][i]); set<string>::iterator it; for(it=x.begin();it!=x.end()&&ans.size()<2;it++){ ans.insert(*it); } } if(idx[0]>='0'&&idx[0]<='9') ans.insert(idx); return ans; } in main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int tc=1; //cin>>tc; while(tc--){ int n; cin>>n; for(int i=0;i<n;i++){ cin>>arr[i]; } for(int i=0;i<n;i++){ string s; cin>>s; arr2[i]=s; mp[arr[i]].pb(s); mp[s].pb(arr[i]); } bool bol=1; for(int i=0;i<n;i++){ bol&=(fun(arr[i]).size()>1?0:1); bol&=(fun(arr2[i]).size()>1?0:1); } cout<<(bol?"DA\n":"NE\n"); } }

Compilation message (stderr)

zamjena.cpp: In function 'std::set<std::__cxx11::basic_string<char> > fun(std::string)':
zamjena.cpp:28:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=0;i<mp[idx].size()&&ans.size()<2;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...