Submission #985638

# Submission time Handle Problem Language Result Execution time Memory
985638 2024-05-18T11:38:28 Z Rux007 Lozinke (COCI17_lozinke) C++14
100 / 100
290 ms 16836 KB
#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

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 time Memory Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Correct 8 ms 1372 KB Output is correct
6 Correct 11 ms 1372 KB Output is correct
7 Correct 15 ms 2100 KB Output is correct
8 Correct 31 ms 2832 KB Output is correct
9 Correct 59 ms 2896 KB Output is correct
10 Correct 122 ms 7784 KB Output is correct
11 Correct 102 ms 4688 KB Output is correct
12 Correct 290 ms 16836 KB Output is correct
13 Correct 189 ms 2896 KB Output is correct
14 Correct 191 ms 14928 KB Output is correct
15 Correct 272 ms 16468 KB Output is correct
16 Correct 187 ms 1412 KB Output is correct
17 Correct 52 ms 1116 KB Output is correct
18 Correct 37 ms 1116 KB Output is correct
19 Correct 190 ms 8888 KB Output is correct
20 Correct 94 ms 1320 KB Output is correct