# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078664 | khactrung1912 | Lozinke (COCI17_lozinke) | C++14 | 1068 ms | 1624 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 ll vector<long long, long long>
#define fi first
#define se second
const int maxn = 2e4 + 10;
const int mod = 1e9 + 7;
const int inf = 1e9;
long long n,m,p,ans,l[maxn];
string a,b,s[maxn];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
//freopen("PASS.INP","r",stdin);
//freopen("PASS.OUT","w",stdout);
cin>>n;
for (int i=1; i<=n; i++) cin>>s[i],l[i]=s[i].size();
for (int i=1; i<=n-1; i++)
for (int j=i+1; j<=n; j++)
{
a=s[i]; b=s[j]; p=l[i]; m=l[j];
if (p==m)
{
if (a==b) ans+=2;
continue;
}
if (p>m)
{
swap(a,b); swap(p,m);
}
b+=a;
if (b.find(a)!=m) ans++;
}
cout<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |