# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472775 | 2021-09-14T10:06:04 Z | Ahmed_Solyman | Lozinke (COCI17_lozinke) | C++14 | 496 ms | 16452 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n;cin>>n; vector<string>arr(n); for(auto &i:arr)cin>>i; map<string,ll>fr; for(ll i=0;i<n;i++){ map<string,bool>vis; for(ll j=0;j<arr[i].size();j++){ string x=""; for(ll k=j;k<arr[i].size();k++){ x+=arr[i][k]; if(!vis[x])fr[x]++,vis[x]=1; } } } ll ans=0; for(ll i=0;i<n;i++){ ans+=fr[arr[i]]-1; } cout<<ans<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 15 ms | 592 KB | Output is correct |
6 | Correct | 19 ms | 672 KB | Output is correct |
7 | Correct | 22 ms | 1392 KB | Output is correct |
8 | Correct | 35 ms | 2252 KB | Output is correct |
9 | Correct | 94 ms | 2308 KB | Output is correct |
10 | Correct | 204 ms | 7492 KB | Output is correct |
11 | Correct | 150 ms | 4124 KB | Output is correct |
12 | Correct | 420 ms | 16452 KB | Output is correct |
13 | Correct | 313 ms | 2696 KB | Output is correct |
14 | Correct | 290 ms | 14828 KB | Output is correct |
15 | Correct | 496 ms | 16208 KB | Output is correct |
16 | Correct | 305 ms | 1072 KB | Output is correct |
17 | Correct | 67 ms | 844 KB | Output is correct |
18 | Correct | 49 ms | 908 KB | Output is correct |
19 | Correct | 290 ms | 8424 KB | Output is correct |
20 | Correct | 146 ms | 1032 KB | Output is correct |