# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
985638 | Rux007 | Lozinke (COCI17_lozinke) | C++14 | 290 ms | 16836 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 <iostream>
#include <string>
#include <map>
using namespace std;
int n;
map<string, int> fr;
string a[20005];
int main()
{
cin >> n;
for(int i = 1; i <= n; i ++)
{
cin >> a[i];
map<string, int> ok;
for(int j = 0; j < a[i].size(); j ++)
for(int t = j; t < a[i].size(); t ++)
{
string aux;
for(int p = j; p <= t; p ++)
aux += a[i][p];
ok[aux] = 1;
}
for(auto x : ok)
fr[x.first] ++;
}
int sol = 0;
for(int i = 1; i <= n; i ++)
sol += fr[a[i]] - 1;
cout << sol;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |