# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472771 | MamdouhN | Lozinke (COCI17_lozinke) | C++14 | 1100 ms | 6556 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;
#define int long long
#define endl "\n"
int n,ans;
string password[200002];
map<string,bool>idk;
void check(string a,string b)
{
idk.clear();
string x;
for(int i=0;i<a.size();i++)
{
x+=a[i];
if(x.size()<=b.size())idk[x]=1;
string y;
int j = i;
while(j>=0&&y.size()<b.size())
{
y=a[j]+y;
idk[y]=1;
j--;
}
}
if(idk[b])ans++;
}
main()
{
cin>>n;
for(int i=0;i<n;i++)cin>>password[i];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(j==i)continue;
if(password[j].size()>password[i].size())continue;
//cout<<password[i]<<" "<<password[j]<<endl;
check(password[i],password[j]);
//cout<<ans<<endl;
}
}
cout<<ans<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |