Submission #80268

# Submission time Handle Problem Language Result Execution time Memory
80268 2018-10-19T17:06:40 Z luciocf Lozinke (COCI17_lozinke) C++14
70 / 100
648 ms 66560 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e4+10;

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

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];

        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[i][aux]++;

                if (mapa2[i][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:20:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int ini = 0; ini < num[i].size(); ini++)
                           ~~~~^~~~~~~~~~~~~~~
lozinke.cpp:23: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 1916 KB Output is correct
2 Correct 3 ms 2044 KB Output is correct
3 Correct 4 ms 2116 KB Output is correct
4 Correct 5 ms 2280 KB Output is correct
5 Correct 17 ms 3944 KB Output is correct
6 Correct 26 ms 5180 KB Output is correct
7 Correct 33 ms 6276 KB Output is correct
8 Correct 52 ms 8900 KB Output is correct
9 Correct 149 ms 18500 KB Output is correct
10 Correct 301 ms 33740 KB Output is correct
11 Correct 236 ms 33740 KB Output is correct
12 Correct 648 ms 64492 KB Output is correct
13 Correct 469 ms 64492 KB Output is correct
14 Correct 481 ms 64492 KB Output is correct
15 Runtime error 614 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Runtime error 484 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
17 Runtime error 133 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
18 Runtime error 73 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
19 Runtime error 520 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
20 Runtime error 229 ms 66560 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.