# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
146798 |
2019-08-26T08:21:29 Z |
Fasho |
Lozinke (COCI17_lozinke) |
C++14 |
|
1000 ms |
62468 KB |
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("kmp.in","r",stdin);freopen ("kmp.out","w",stdout);
#define mod 1000000009
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
#define INF 1000000000005
using namespace std;
ll n,m,ar[N],sum;
string s[N],tmp;
map<string,ll> mp,mark;
int main()
{
fast;
cin>>n;
fo(i,1,n)
cin>>s[i];
fo(i,1,n)
{
int x=s[i].size();
for(int j=0;j<x;j++)
{
for(int g=0;g<=j;g++)
{
tmp.clear();
for(int h=g;h<=j;h++)
{
// cerr<<i<<endl;
tmp.pb(s[i][h]);
}
if(!mark[tmp])
mp[tmp]++;
mark[tmp]++;
// cout<<tmp<<sp;
}
}
// cout<<endl;
for(int j=0;j<x;j++)
{
for(int g=0;g<=j;g++)
{
tmp.clear();
for(int h=g;h<=j;h++)
{
tmp.pb(s[i][h]);
}
mark[tmp]=0;
}
}
}
fo(i,1,n)
sum+=mp[s[i]]-1;
cout<<sum;
}
/* cd onedrive\desktop\kod
cls
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
31736 KB |
Output is correct |
2 |
Correct |
31 ms |
31608 KB |
Output is correct |
3 |
Correct |
39 ms |
31864 KB |
Output is correct |
4 |
Correct |
36 ms |
31776 KB |
Output is correct |
5 |
Correct |
50 ms |
32376 KB |
Output is correct |
6 |
Correct |
73 ms |
32376 KB |
Output is correct |
7 |
Correct |
87 ms |
33848 KB |
Output is correct |
8 |
Correct |
136 ms |
35448 KB |
Output is correct |
9 |
Correct |
249 ms |
35484 KB |
Output is correct |
10 |
Correct |
541 ms |
45528 KB |
Output is correct |
11 |
Correct |
412 ms |
38920 KB |
Output is correct |
12 |
Execution timed out |
1077 ms |
62468 KB |
Time limit exceeded |
13 |
Correct |
670 ms |
35448 KB |
Output is correct |
14 |
Correct |
832 ms |
59896 KB |
Output is correct |
15 |
Execution timed out |
1074 ms |
61564 KB |
Time limit exceeded |
16 |
Correct |
517 ms |
32248 KB |
Output is correct |
17 |
Correct |
173 ms |
31992 KB |
Output is correct |
18 |
Correct |
123 ms |
31864 KB |
Output is correct |
19 |
Correct |
799 ms |
47100 KB |
Output is correct |
20 |
Correct |
284 ms |
32252 KB |
Output is correct |