Submission #661328

#TimeUsernameProblemLanguageResultExecution timeMemory
661328Trisanu_DasLozinke (COCI17_lozinke)C++17
100 / 100
174 ms15996 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string a[n]; unordered_set<string> s; unordered_map<string, int> m; for(int i = 0;i < n; i++){ cin >> a[i]; s.clear(); for(int j = 0;j < a[i].size(); j++){ string ss; for(int k = j; k < a[i].size(); k++){ ss += a[i][k]; s.insert(ss); } } for(auto &x : s) m[x]++; } int ans = 0; for(auto &x:a) ans += m[x]; cout << ans - n << '\n'; }

Compilation message (stderr)

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