# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
146802 |
2019-08-26T08:38:14 Z |
Fasho |
Lozinke (COCI17_lozinke) |
C++14 |
|
159 ms |
65540 KB |
#include <bits/stdc++.h>
#define N 2005
#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],st[20001][10][10];
map<string,ll> mp,mark;
void pre()
{
// cerr<<"HELLO"<<endl;
fo(i,1,n)
cin>>s[i];
for(int i=1;i<=n;i++)
{
int x=s[i].size();
for(int j=0;j<x;j++)
{
for(int h=0;h<=j;h++)
{
string tmp;
for(int g=h;g<=j;g++)
st[i][j][h].pb(s[i][g]);
// st[i][j][h]=tmp;
}
}
}
}
int main()
{
fast;
cin>>n;
pre();
// cerr<<"HELLO"<<endl;
fo(i,1,n)
{
int x=s[i].size();
for(int j=0;j<x;j++)
{
for(int g=0;g<=j;g++)
{
string tmp=st[i][j][g];
if(!mark[tmp])
mark[tmp]++,mp[tmp]++;
}
}
// cout<<endl;
for(int j=0;j<x;j++)
{
for(int g=0;g<=j;g++)
{
string tmp=st[i][j][g];
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 |
60 ms |
63096 KB |
Output is correct |
2 |
Correct |
60 ms |
63096 KB |
Output is correct |
3 |
Correct |
61 ms |
63096 KB |
Output is correct |
4 |
Correct |
62 ms |
63096 KB |
Output is correct |
5 |
Correct |
85 ms |
63736 KB |
Output is correct |
6 |
Correct |
95 ms |
63768 KB |
Output is correct |
7 |
Correct |
112 ms |
65272 KB |
Output is correct |
8 |
Runtime error |
108 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
9 |
Runtime error |
76 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
10 |
Runtime error |
68 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
11 |
Runtime error |
147 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
151 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
154 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
158 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
159 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
151 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
150 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
150 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
147 ms |
65536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
66 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |