Submission #80271

# Submission time Handle Problem Language Result Execution time Memory
80271 2018-10-19T17:10:02 Z luciocf Lozinke (COCI17_lozinke) C++14
100 / 100
599 ms 17008 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e4+10;

string num[maxn];
map<string, int> mapa, mapa2;

int main(void)
{
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;

    for (int i = 1; i <= n; i++)
    {
        cin >> num[i];
        mapa2.clear();

        for (int ini = 0; ini < num[i].size(); ini++)
        {
            string aux = "";
            for (int fim = ini; fim < num[i].size(); fim++)
            {
                aux += num[i][fim];
                mapa2[aux]++;

                if (mapa2[aux] == 1) mapa[aux]++;
            }
        }
    }

    long long ans = 0LL;
    for (int i = 1; i <= n; i++)
        ans += ((long long)mapa[num[i]]-1LL);

    cout << ans << "\n";
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:21:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int ini = 0; ini < num[i].size(); ini++)
                           ~~~~^~~~~~~~~~~~~~~
lozinke.cpp:24:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int fim = ini; fim < num[i].size(); fim++)
                                 ~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1016 KB Output is correct
2 Correct 2 ms 1148 KB Output is correct
3 Correct 3 ms 1148 KB Output is correct
4 Correct 4 ms 1148 KB Output is correct
5 Correct 14 ms 1480 KB Output is correct
6 Correct 23 ms 1600 KB Output is correct
7 Correct 29 ms 2316 KB Output is correct
8 Correct 46 ms 3068 KB Output is correct
9 Correct 119 ms 3068 KB Output is correct
10 Correct 254 ms 7988 KB Output is correct
11 Correct 206 ms 7988 KB Output is correct
12 Correct 599 ms 17008 KB Output is correct
13 Correct 360 ms 17008 KB Output is correct
14 Correct 380 ms 17008 KB Output is correct
15 Correct 561 ms 17008 KB Output is correct
16 Correct 379 ms 17008 KB Output is correct
17 Correct 84 ms 17008 KB Output is correct
18 Correct 61 ms 17008 KB Output is correct
19 Correct 438 ms 17008 KB Output is correct
20 Correct 194 ms 17008 KB Output is correct