제출 #1340479

#제출 시각아이디문제언어결과실행 시간메모리
1340479kawhietLozinke (COCI17_lozinke)C++20
25 / 100
178 ms16580 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<string> a;
    map<string, int> cnt;
    for (int _ = 0; _ < n; _++) {
        string s;
        cin >> s;
        for (int i = 0; i < s.size(); i++) {
            for (int j = i; j < s.size(); j++) {
                cnt[s.substr(i, j - i + 1)]++;
            }
        }
        a.push_back(s);
    }
    int ans = 0;
    for (auto x : a) {
        ans += cnt[x] - 1;
    }
    cout << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...