답안 #95384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
95384 2019-01-31T07:52:36 Z teomrn Lozinke (COCI17_lozinke) C++14
100 / 100
554 ms 16552 KB
#include <bits/stdc++.h>
using namespace std;

void solve()
{
    map <string, int> Hash, act;
    int n;
    cin >> n;
    long long ans = -n;
    vector <string> v(n);

    for (auto & i: v) {
        cin >> i;
        Hash[i]++;
    }

    for (auto s : v) {
        act.clear();
        for (int beg = 0; beg < s.size(); beg++) {
            string q = "";
            for (int i = beg; i < s.size(); i++) {
                q += s[i];
                if (act.find(q) == act.end()) {
                    act[q] = 1;
                    ans += Hash[q];
                }
            }
        }
    }

    cout << ans << '\n';
}

int main()
{
    solve();
    return 0;
}

Compilation message

lozinke.cpp: In function 'void solve()':
lozinke.cpp:19:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int beg = 0; beg < s.size(); beg++) {
                           ~~~~^~~~~~~~~~
lozinke.cpp:21:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = beg; i < s.size(); i++) {
                               ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 380 KB Output is correct
5 Correct 11 ms 732 KB Output is correct
6 Correct 19 ms 760 KB Output is correct
7 Correct 24 ms 1528 KB Output is correct
8 Correct 40 ms 2296 KB Output is correct
9 Correct 102 ms 2424 KB Output is correct
10 Correct 230 ms 7516 KB Output is correct
11 Correct 167 ms 4216 KB Output is correct
12 Correct 463 ms 16552 KB Output is correct
13 Correct 318 ms 2680 KB Output is correct
14 Correct 347 ms 14968 KB Output is correct
15 Correct 554 ms 16304 KB Output is correct
16 Correct 305 ms 1272 KB Output is correct
17 Correct 54 ms 1164 KB Output is correct
18 Correct 41 ms 1016 KB Output is correct
19 Correct 359 ms 8568 KB Output is correct
20 Correct 147 ms 1272 KB Output is correct