답안 #793852

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
793852 2023-07-26T07:27:25 Z Hard_slipper Lozinke (COCI17_lozinke) C++14
25 / 100
188 ms 16228 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++)
            {
                unordered_map<string, int> tmp_substr_freq;
                for(int k = j; k < s.size(); k++)
                {
                    string substring = s.substr(j, (k-j)+1);
                    //cout << substring << '\n';
                    tmp_substr_freq[substring] = 1;
                }
                for(auto it : tmp_substr_freq)
                {
                    substr_freq[it.first]++;
                }
            }
        }
        int ans = 0;
        //cout << substr_freq["t"] << '\n';
        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:24: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]
   24 |                 for(int k = j; k < s.size(); k++)
      |                                ~~^~~~~~~~~~
lozinke.cpp:11:9: warning: unused variable 'ot' [-Wunused-variable]
   11 |     int ot = T;
      |         ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 324 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Incorrect 1 ms 340 KB Output isn't correct
4 Incorrect 2 ms 328 KB Output isn't correct
5 Incorrect 5 ms 596 KB Output isn't correct
6 Incorrect 8 ms 720 KB Output isn't correct
7 Incorrect 14 ms 1376 KB Output isn't correct
8 Correct 14 ms 2260 KB Output is correct
9 Incorrect 39 ms 2416 KB Output isn't correct
10 Correct 70 ms 8048 KB Output is correct
11 Incorrect 62 ms 4388 KB Output isn't correct
12 Correct 152 ms 16228 KB Output is correct
13 Incorrect 121 ms 2884 KB Output isn't correct
14 Incorrect 153 ms 15960 KB Output isn't correct
15 Correct 188 ms 16172 KB Output is correct
16 Incorrect 157 ms 1728 KB Output isn't correct
17 Correct 156 ms 1636 KB Output is correct
18 Incorrect 108 ms 1620 KB Output isn't correct
19 Incorrect 112 ms 8468 KB Output isn't correct
20 Incorrect 89 ms 1648 KB Output isn't correct