Submission #98894

#TimeUsernameProblemLanguageResultExecution timeMemory
98894OrtLozinke (COCI17_lozinke)C++11
100 / 100
469 ms15212 KiB
#include<iostream> #include<string> #include<vector> #include<unordered_map> #include<unordered_set> using namespace std; unordered_map<string,int> um; unordered_set<string> us; vector<string> vs; int n; string s; int sol = 0; int main() { cin >> n; for(int i=0;i<n;i++) { us.clear(); cin >> s; vs.push_back(s); for(int j=0;j<s.size();j++) for(int k=1;k<=s.size()-j;k++) if(us.find(s.substr(j,k))==us.end()) { um[s.substr(j,k)] += 1; us.insert(s.substr(j,k)); } } for(int i=0;i<vs.size();i++) sol += (um[vs[i]] - 1); cout << sol; return 0; }

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:23:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
        for(int j=0;j<s.size();j++)
                    ~^~~~~~~~~
lozinke.cpp:24:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          for(int k=1;k<=s.size()-j;k++)
                      ~^~~~~~~~~~~~
lozinke.cpp:30:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=0;i<vs.size();i++) sol += (um[vs[i]] - 1);
                ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...