# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
515731 | MurotY | Lozinke (COCI17_lozinke) | C++14 | 429 ms | 16812 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=22222;
string a[N];
int main()
{
int n;
cin >> n;
for (int i=1;i<=n;i++) cin >> a[i];
map <string, int> mp;
int ans=0;
for (int i=1;i<=n;i++){
map <string , int> mp1;
for (int j=0;j<a[i].size();j++){
string s;
for (int j1=j;j1<a[i].size();j1++){
s=s+a[i][j1];
// cout << s <<"\n";
if (mp1[s] == 0) mp1[s]++, mp[s]++;
}
}
}
for (int i=1;i<=n;i++) ans+=mp[a[i]]-1;
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |