Submission #914711

#TimeUsernameProblemLanguageResultExecution timeMemory
914711racsosabeLozinke (COCI17_lozinke)C++14
100 / 100
287 ms16728 KiB
#include<bits/stdc++.h> using namespace::std; const int N = 20000 + 5; int n; string s[N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; map<string, int> frec; for(int i = 1; i <= n; i++) { cin >> s[i]; frec[s[i]] += 1; } long long res = 0; for(int id = 1; id <= n; id++) { set<string> used; for(int i = 0; i < s[id].size(); i++) { string cur = ""; for(int j = i; j < s[id].size(); j++) { cur.push_back(s[id][j]); if(!used.count(cur)) { used.emplace(cur); res += frec[cur]; } } } res -= 1; } cout << res << endl; return 0; }

Compilation message (stderr)

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