Submission #95384

#TimeUsernameProblemLanguageResultExecution timeMemory
95384teomrnLozinke (COCI17_lozinke)C++14
100 / 100
554 ms16552 KiB
#include <bits/stdc++.h> using namespace std; void solve() { map <string, int> Hash, act; int n; cin >> n; long long ans = -n; vector <string> v(n); for (auto & i: v) { cin >> i; Hash[i]++; } for (auto s : v) { act.clear(); for (int beg = 0; beg < s.size(); beg++) { string q = ""; for (int i = beg; i < s.size(); i++) { q += s[i]; if (act.find(q) == act.end()) { act[q] = 1; ans += Hash[q]; } } } } cout << ans << '\n'; } int main() { solve(); return 0; }

Compilation message (stderr)

lozinke.cpp: In function 'void solve()':
lozinke.cpp:19:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int beg = 0; beg < s.size(); beg++) {
                           ~~~~^~~~~~~~~~
lozinke.cpp:21:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = beg; i < s.size(); i++) {
                               ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...