Submission #798321

# Submission time Handle Problem Language Result Execution time Memory
798321 2023-07-30T15:16:41 Z Hard_slipper Lozinke (COCI17_lozinke) C++14
25 / 100
173 ms 16116 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T = 1; //cin >> T;
    int ot = T;
    while(T--)
    {
        int n; cin >> n;
        unordered_map<string, int> substr_freq;
        vector<string> strs;
        for(int i = 0; i < n; i++)
        {
            string s; cin >> s;
            strs.push_back(s);
            for(int j = 0; j < s.size(); j++)
            {
                set<string> uniq;
                string substring = "";
                for(int k = j; k < s.size(); k++)
                {
                    substring += s[k];
                    //cout << substring << '\n';
                    uniq.insert(substring);
                }
                for(auto it : uniq)
                {
                    substr_freq[it]++;
                }
            }
        }
        int ans = 0;
        for(int i = 0; i < n; i++)
        {
            ans += substr_freq[strs[i]]-1;
        }
        cout << ans << '\n';
    }
}

Compilation message

lozinke.cpp: In function 'int32_t main()':
lozinke.cpp:21:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for(int j = 0; j < s.size(); j++)
      |                            ~~^~~~~~~~~~
lozinke.cpp:25:34: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |                 for(int k = j; k < s.size(); k++)
      |                                ~~^~~~~~~~~~
lozinke.cpp:11:9: warning: unused variable 'ot' [-Wunused-variable]
   11 |     int ot = T;
      |         ^~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Incorrect 1 ms 316 KB Output isn't correct
5 Incorrect 4 ms 712 KB Output isn't correct
6 Incorrect 5 ms 712 KB Output isn't correct
7 Incorrect 7 ms 1364 KB Output isn't correct
8 Correct 13 ms 2176 KB Output is correct
9 Incorrect 30 ms 2432 KB Output isn't correct
10 Correct 60 ms 7992 KB Output is correct
11 Incorrect 40 ms 4480 KB Output isn't correct
12 Correct 173 ms 16116 KB Output is correct
13 Incorrect 90 ms 2872 KB Output isn't correct
14 Incorrect 89 ms 15908 KB Output isn't correct
15 Correct 115 ms 16080 KB Output is correct
16 Incorrect 99 ms 1604 KB Output isn't correct
17 Correct 97 ms 1604 KB Output is correct
18 Incorrect 82 ms 1548 KB Output isn't correct
19 Incorrect 68 ms 8424 KB Output isn't correct
20 Incorrect 48 ms 1544 KB Output isn't correct