Submission #928998

#TimeUsernameProblemLanguageResultExecution timeMemory
928998NourWaelLozinke (COCI17_lozinke)C++17
100 / 100
356 ms16720 KiB
#include <bits/stdc++.h> #define int long long using namespace std; map<string,int> mp; string a[20005]; signed main() { int n; cin>>n; for(int i=0; i<n; i++){ string s; cin>>s; a[i] = s; mp[s]++; } int ans = 0; for(int i=0; i<n; i++){ string s = a[i]; set<string> st; for(int j=0; j<s.size(); j++){ string t = ""; for(int k=j; k<s.size(); k++) { t+=s[k]; if(st.find(t)==st.end()) ans += mp[t]; st.insert(t); } } ans--; } cout<<ans; return 0; }

Compilation message (stderr)

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