Submission #985638

#TimeUsernameProblemLanguageResultExecution timeMemory
985638Rux007Lozinke (COCI17_lozinke)C++14
100 / 100
290 ms16836 KiB
#include <iostream>
#include <string>
#include <map>

using namespace std;

int n;
map<string, int> fr;
string a[20005];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        cin >> a[i];

        map<string, int> ok;
        for(int j = 0; j < a[i].size(); j ++)
            for(int t = j; t < a[i].size(); t ++)
            {
                string aux;
                for(int p = j; p <= t; p ++)
                    aux += a[i][p];

                ok[aux] = 1;
            }


        for(auto x : ok)
            fr[x.first] ++;
    }

    int sol = 0;
    for(int i = 1; i <= n; i ++)
        sol += fr[a[i]] - 1;

    cout << sol;
    return 0;
}

Compilation message (stderr)

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