Submission #515731

#TimeUsernameProblemLanguageResultExecution timeMemory
515731MurotYLozinke (COCI17_lozinke)C++14
100 / 100
429 ms16812 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; const int N=22222; string a[N]; int main() { int n; cin >> n; for (int i=1;i<=n;i++) cin >> a[i]; map <string, int> mp; int ans=0; for (int i=1;i<=n;i++){ map <string , int> mp1; for (int j=0;j<a[i].size();j++){ string s; for (int j1=j;j1<a[i].size();j1++){ s=s+a[i][j1]; // cout << s <<"\n"; if (mp1[s] == 0) mp1[s]++, mp[s]++; } } } for (int i=1;i<=n;i++) ans+=mp[a[i]]-1; cout << ans; return 0; }

Compilation message (stderr)

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