# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472757 | MamdouhN | Lozinke (COCI17_lozinke) | C++14 | 1098 ms | 6536 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];
void check(string a,string b)
{
bool cando=0;
int sizeofb = b.size();
int i=0;
while(i+b.size()<=a.size())
{
if(a[i]==b[0])
{
int j=0,sizee=0;
while(a[i]==b[j]&&i<a.size()&&j<sizeofb)
{
i++;
j++;
sizee++;
}
i--;
//cout<<sizee<<endl;
if(sizee==sizeofb)
{
ans++;
return;
}
}
i++;
}
}
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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |