Submission #1078167

#TimeUsernameProblemLanguageResultExecution timeMemory
1078167vnamLozinke (COCI17_lozinke)C++14
40 / 100
1073 ms900 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e4 + 5; string a[N]; bool check(string &x, string &y){ // int l = 0, r = 0; // int n = x.size(), m = y.size(); // while (l < n && r < m){ // if (x[l] == y[r]){ // l++; // r++; // } // else r++; // } // return l == n; return y.find(x) != string::npos; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; int ans = 0; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (i != j) ans += check(a[j], a[i]); cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...