# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472748 | Mr_OK_Man | Lozinke (COCI17_lozinke) | C++17 | 1098 ms | 2252 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>
using namespace std;
int main()
{
// cout << "Hello world!" << endl;
long long n,c=0;
cin>>n;
vector<string>a(n);
map<string,long long>mp;
for(int i=0;i<n;i++)
{
cin>>a[i];
mp[a[i]]++;
}
//sort(a.begin(),a.end());
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(j==i){continue;}
if(a[i].size()>a[j].size())
{
continue;
}
for(int k=0;k<a[j].size();k++)
{
if(k+a[i].size()-1>a[j].size())
{
break;
}
//cout<<a[i]<<" "<<a[j].substr(k,a[i].size())<<endl;
if(a[j].substr(k,a[i].size())==a[i])
{
c++;
break;
}
}
}
}
/* for(auto i:a)
{
cout<<i<<endl;
c+=mp[i]-1;
}*/
cout<<c<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |