# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
472823 | 2021-09-14T11:30:27 Z | Ahmed57 | Lozinke (COCI17_lozinke) | C++14 | 444 ms | 16580 KB |
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); map<string,int> mp; long long n,ans = 0; cin>>n; vector<string> v(n); for(int i = 0;i<n;i++){ string s; cin>>s; v[i]=s; map<string,int> ch; for(int j = 0;j<s.size();j++){ for(int k = j+1;k<=s.size();k++){ string f = s.substr(j,k-j); if(ch[f]==0){ ch[f]=1; mp[f]++; } } } } for(int i = 0;i<n;i++){ ans+=mp[v[i]]-1; } cout<<ans<<"\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 10 ms | 716 KB | Output is correct |
6 | Correct | 17 ms | 716 KB | Output is correct |
7 | Correct | 23 ms | 1500 KB | Output is correct |
8 | Correct | 39 ms | 2204 KB | Output is correct |
9 | Correct | 92 ms | 2372 KB | Output is correct |
10 | Correct | 191 ms | 7428 KB | Output is correct |
11 | Correct | 148 ms | 4292 KB | Output is correct |
12 | Correct | 427 ms | 16540 KB | Output is correct |
13 | Correct | 282 ms | 2944 KB | Output is correct |
14 | Correct | 306 ms | 14984 KB | Output is correct |
15 | Correct | 444 ms | 16580 KB | Output is correct |
16 | Correct | 308 ms | 1292 KB | Output is correct |
17 | Correct | 72 ms | 1056 KB | Output is correct |
18 | Correct | 52 ms | 1100 KB | Output is correct |
19 | Correct | 294 ms | 8604 KB | Output is correct |
20 | Correct | 154 ms | 1220 KB | Output is correct |