답안 #116844

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116844 2019-06-14T02:34:50 Z taozai123 Lozinke (COCI17_lozinke) C++14
100 / 100
254 ms 15160 KB
#include<bits/stdc++.h>

using namespace std;

int n;

string l[20014];

unordered_set<string> s;
unordered_map<string, int> cnt;

int main(void) {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> l[i];
    s.clear();

    for (int j = 0; j < (int) l[i].size(); ++j) {
      string a;
      for (int k = j; k < (int) l[i].size(); ++k) {
        a.push_back(l[i][k]);
       
        s.insert(a);
      }
    }

    for (auto &x : s)
      cnt[x]++;
  }

  int sol = 0;
  for (auto &x : l)
    sol += cnt[x];

  cout << sol - n << endl;

  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1024 KB Output is correct
2 Correct 3 ms 1024 KB Output is correct
3 Correct 3 ms 1024 KB Output is correct
4 Correct 3 ms 1024 KB Output is correct
5 Correct 7 ms 1280 KB Output is correct
6 Correct 9 ms 1280 KB Output is correct
7 Correct 13 ms 2048 KB Output is correct
8 Correct 21 ms 2632 KB Output is correct
9 Correct 44 ms 2680 KB Output is correct
10 Correct 113 ms 7244 KB Output is correct
11 Correct 70 ms 4124 KB Output is correct
12 Correct 235 ms 15160 KB Output is correct
13 Correct 107 ms 2552 KB Output is correct
14 Correct 170 ms 13884 KB Output is correct
15 Correct 254 ms 15044 KB Output is correct
16 Correct 104 ms 1024 KB Output is correct
17 Correct 57 ms 896 KB Output is correct
18 Correct 45 ms 1024 KB Output is correct
19 Correct 174 ms 7856 KB Output is correct
20 Correct 62 ms 1128 KB Output is correct