# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
80263 | thiago4532 | Lozinke (COCI17_lozinke) | C++17 | 1091 ms | 3508 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>
#define gc getchar
#define rep(i, a, b) for(int i=a;i<=b;i++)
#define rep2(i, a, b) for(int i=a;i>=b;--i)
#define wipe(a, b) memset(a, b, sizeof a);
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef pair<int, int> pii;
inline int scan(){
int n=0, x=gc(), s=1;
for(;x<'0'||x>'9';x=gc()) if(x=='-') s=-1;
for(;x>='0'&&x<='9';x=gc()) n = 10*n + x - '0';
return n*s;
}
int gcd(int a, int b){
return (b?gcd(b, a%b):a);
}
int main(){
ios::sync_with_stdio(false), cin.tie(0);
int n;
cin >> n;
vector<string> str;
for(int i=1;i<=n;i++){
string x;
cin >> x;
str.push_back(x);
}
int ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i == j) continue;
if(str[i].size() < str[j].size()) continue;
// Checar s(j) substring de s(i)
for(int l=0;l<=(int)str[i].size()-str[j].size();l++){
int qtd=0;
while(qtd < str[j].size()){
if(str[i][qtd+l] == str[j][qtd]) qtd++;
else break;
}
if(qtd == str[j].size()){
ans++;
break;
}
}
}
}
cout << ans << "\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |