Submission #472748

#TimeUsernameProblemLanguageResultExecution timeMemory
472748Mr_OK_ManLozinke (COCI17_lozinke)C++17
40 / 100
1098 ms2252 KiB
#include <bits/stdc++.h> using namespace std; int main() { // cout << "Hello world!" << endl; long long n,c=0; cin>>n; vector<string>a(n); map<string,long long>mp; for(int i=0;i<n;i++) { cin>>a[i]; mp[a[i]]++; } //sort(a.begin(),a.end()); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(j==i){continue;} if(a[i].size()>a[j].size()) { continue; } for(int k=0;k<a[j].size();k++) { if(k+a[i].size()-1>a[j].size()) { break; } //cout<<a[i]<<" "<<a[j].substr(k,a[i].size())<<endl; if(a[j].substr(k,a[i].size())==a[i]) { c++; break; } } } } /* for(auto i:a) { cout<<i<<endl; c+=mp[i]-1; }*/ cout<<c<<endl; return 0; }

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:29:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |            for(int k=0;k<a[j].size();k++)
      |                        ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...