Submission #500165

# Submission time Handle Problem Language Result Execution time Memory
500165 2021-12-30T12:06:32 Z kappa Lozinke (COCI17_lozinke) C++14
100 / 100
351 ms 16564 KB
#include <bits/stdc++.h>

using namespace std;

int n, ans;



set<string> s;
map<string, int> m;

int main(){
    cin >> n;

    string str[n];

    for (int i = 0; i < n; i++)
    {
        cin >> str[i];
    }

    for (int i = 0; i < n; i++)
    {
        s.clear();

        for (int k = 0; k < str[i].size(); k++)
        {
            string tmp;

            for (int j = k; j < str[i].size(); j++)
            {
                tmp.push_back(str[i][j]);
                s.insert(tmp);
            }   
        }

        for (auto c : s)
        {
            m[c]++;
        }
    }

    for (auto i : str)
    {
        ans += m[i] - 1;
    }

    cout << ans;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for (int k = 0; k < str[i].size(); k++)
      |                         ~~^~~~~~~~~~~~~~~
lozinke.cpp:30:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             for (int j = k; j < str[i].size(); j++)
      |                             ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 284 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 292 KB Output is correct
5 Correct 7 ms 680 KB Output is correct
6 Correct 12 ms 596 KB Output is correct
7 Correct 17 ms 1432 KB Output is correct
8 Correct 30 ms 2244 KB Output is correct
9 Correct 89 ms 2420 KB Output is correct
10 Correct 136 ms 7528 KB Output is correct
11 Correct 130 ms 4252 KB Output is correct
12 Correct 351 ms 16564 KB Output is correct
13 Correct 201 ms 2868 KB Output is correct
14 Correct 222 ms 14888 KB Output is correct
15 Correct 323 ms 16408 KB Output is correct
16 Correct 214 ms 1260 KB Output is correct
17 Correct 52 ms 1060 KB Output is correct
18 Correct 38 ms 972 KB Output is correct
19 Correct 235 ms 8580 KB Output is correct
20 Correct 101 ms 1160 KB Output is correct