Submission #79819

#TimeUsernameProblemLanguageResultExecution timeMemory
79819pzdbaLozinke (COCI17_lozinke)C++14
100 / 100
574 ms17776 KiB
#include <bits/stdc++.h> using namespace std; typedef long long LL; map<string, int> dp; string s[20005]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); LL ans = 0; int n; cin >> n; for(int i=1;i<=n;i++){ cin >> s[i]; int l = s[i].length(); vector<string> v; for(int j=0;j<l;j++){ for(int k=j;k<l;k++){ int le = k-j+1; string x = s[i].substr(j, le); v.emplace_back(x); } } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); for(int i=0;i<v.size();i++){ dp[v[i]]++; } } for(int i=1;i<=n;i++){ ans += dp[s[i]]; } cout << ans-n << "\n"; }

Compilation message (stderr)

lozinke.cpp: In function 'int main()':
lozinke.cpp:25:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<v.size();i++){
               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...