Submission #472773

#TimeUsernameProblemLanguageResultExecution timeMemory
472773Mr_OK_ManLozinke (COCI17_lozinke)C++17
100 / 100
411 ms16404 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()); set<string>s; for(int i=0;i<n;i++) { //COUNT ALL OCCURNCES IN A SET s.clear(); for(int j=0;j<a[i].size();j++) { string h=""; /* h+=a[i].substr(j,a[i].size()-j); cout<<h<<endl; string k=""; k+=a[i].substr(0,j); cout<<k<<endl; s.insert(h); s.insert(k);*/ for(int l=j;l<a[i].size();l++) { h+=a[i][l]; s.insert(h); } } for(auto i:s) { c+=mp[i]; } } /* for(auto i:a) { cout<<i<<endl; c+=mp[i]-1; }*/ cout<<c-n<<endl;//#HABDA return 0; }

Compilation message (stderr)

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