# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677607 | Mariabf | Lozinke (COCI17_lozinke) | C++17 | 1097 ms | 1108 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;
bool comp(string a, string b){
for(int i=0; i<a.size(); i++){
for(int j=0; j<b.size(); j++){
if(a[i+j]!=b[j])break;
if(j==b.size()-1)return true;
}
}
return false;
}
int main(){
int n;
cin>>n;
vector<string>v(n);
for(int i=0; i<n; i++){
cin>>v[i];
}int ans=0;
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
if(v[i].size()>v[j].size()){
ans+=comp(v[i], v[j]);
}
else if(v[i].size()==v[j].size()){
ans+=2*comp(v[j], v[i]);
}
else{
ans+=comp(v[j], v[i]);
}
}
}cout<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |