# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078668 | khactrung1912 | Lozinke (COCI17_lozinke) | C++14 | 2 ms | 524 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;
long long n, re;
vector<string> a;
int main() {
ios_base::sync_with_stdio(0);
cin.tie();
cout.tie();
freopen("PASS.INP", "r", stdin);
freopen("PASS.OUT", "w", stdout);
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
a.push_back(s);
}
if (n<=2000) {
for (int i = 0; i < a.size(); i++) {
for (int j = 0; j < a.size(); j++) {
if (i==j) continue;
if (a[i].size()>a[j].size()) {
for (int k = 0; k < a[i].size()-a[j].size()+1; k++) {
if (a[i].substr(0, k+1)==a[j]) {
re++;
break;
}
}
}
else if (a[i]==a[j]) re++;
}
}
cout << re;
}
else cout << 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |