Submission #238170

# Submission time Handle Problem Language Result Execution time Memory
238170 2020-06-10T05:55:34 Z 74TrAkToR Lozinke (COCI17_lozinke) C++17
0 / 100
494 ms 16760 KB
#include<bits/stdc++.h>

using namespace std;

map < string, int > cnt;
string s[20005];

main() {
#ifdef HOME
    //freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, ans = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> s[i];
    }
    sort(s + 1, s + n + 1, [](string f, string t) {
        return (int)f.size() > (int)t.size();
    });
    for (int i = 1; i <= n; ++i) {
        set < string > Q;
        ans += cnt[s[i]];
        for (int j = 0; j < (int)s[i].size(); ++j) {
            string t = "";
            for (int pos = j; pos < (int)s[i].size(); ++pos) {
                t += s[i][pos];
                Q.insert(t);
            }
        }
        for (auto key : Q) cnt[key]++;
    }
    cout << ans << '\n';
    return 0;
}

Compilation message

lozinke.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1024 KB Output isn't correct
2 Incorrect 5 ms 1024 KB Output isn't correct
3 Incorrect 6 ms 1024 KB Output isn't correct
4 Incorrect 6 ms 1024 KB Output isn't correct
5 Incorrect 15 ms 1408 KB Output isn't correct
6 Incorrect 22 ms 1280 KB Output isn't correct
7 Incorrect 28 ms 2048 KB Output isn't correct
8 Incorrect 40 ms 2944 KB Output isn't correct
9 Incorrect 103 ms 2808 KB Output isn't correct
10 Incorrect 211 ms 7928 KB Output isn't correct
11 Incorrect 174 ms 4472 KB Output isn't correct
12 Incorrect 494 ms 16760 KB Output isn't correct
13 Incorrect 303 ms 2912 KB Output isn't correct
14 Incorrect 331 ms 15096 KB Output isn't correct
15 Incorrect 490 ms 16600 KB Output isn't correct
16 Incorrect 320 ms 1400 KB Output isn't correct
17 Incorrect 111 ms 1232 KB Output isn't correct
18 Incorrect 64 ms 1152 KB Output isn't correct
19 Incorrect 333 ms 8672 KB Output isn't correct
20 Incorrect 153 ms 1280 KB Output isn't correct