# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
170324 | 2019-12-24T20:01:00 Z | ngmh | Lozinke (COCI17_lozinke) | C++11 | 306 ms | 15420 KB |
#include <bits/stdc++.h> using namespace std; long long n, c; string s[20000], t; unordered_map<string, long long> ori; set<string> sub; int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> s[i]; if(ori.count(s[i]) == 0) ori[s[i]] = 1; else ori[s[i]]++; } for(int i = 0; i < n; i++){ for(int j = 0; j < s[i].size(); j++){ t = ""; for(int k = j; k < s[i].size(); k++){ t += s[i][k]; sub.insert(t); } } for(auto it: sub){ c += ori[it]; } c--; sub.clear(); } cout << c; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 888 KB | Output is correct |
2 | Correct | 3 ms | 1144 KB | Output is correct |
3 | Correct | 3 ms | 1016 KB | Output is correct |
4 | Correct | 3 ms | 1016 KB | Output is correct |
5 | Correct | 9 ms | 1272 KB | Output is correct |
6 | Correct | 15 ms | 1272 KB | Output is correct |
7 | Correct | 18 ms | 2040 KB | Output is correct |
8 | Correct | 26 ms | 2680 KB | Output is correct |
9 | Correct | 66 ms | 2652 KB | Output is correct |
10 | Correct | 133 ms | 7320 KB | Output is correct |
11 | Correct | 107 ms | 4264 KB | Output is correct |
12 | Correct | 288 ms | 15420 KB | Output is correct |
13 | Correct | 189 ms | 2808 KB | Output is correct |
14 | Correct | 223 ms | 14012 KB | Output is correct |
15 | Correct | 306 ms | 15164 KB | Output is correct |
16 | Correct | 207 ms | 1272 KB | Output is correct |
17 | Correct | 77 ms | 1200 KB | Output is correct |
18 | Correct | 59 ms | 1272 KB | Output is correct |
19 | Correct | 195 ms | 7972 KB | Output is correct |
20 | Correct | 112 ms | 1272 KB | Output is correct |