# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
234389 |
2020-05-24T06:51:33 Z |
Vimmer |
Lozinke (COCI17_lozinke) |
C++14 |
|
1000 ms |
16528 KB |
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
#define sz(x) ll(x.size())
#define base 1000000
#define M ll(1e9+7)
#define N 100005
#define F first
#define S second
#define pb push_back
#define in insert
#define eb emplace_back
#define ed "\n"
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef short int si;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
map <string, int> mp;
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ans =0 ;
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) cin >> s[i];
for (int i = 0; i < n; i++)
{
set <string> se; se.clear();
for (int kl = 0; kl < sz(s[i]); kl++)
for (int kr = 0; kr < sz(s[i]) - kl; kr++)
{
string str = "";
for (int j = kl; j < sz(s[i]) - kr; j++) str += s[i][j];
if (se.find(str) == se.end()) mp[str]++;
se.insert(str);
}
}
for (int i = 0; i < n; i++)
{
set <string> se; se.clear();
for (int kl = 0; kl < sz(s[i]); kl++)
for (int kr = 0; kr < sz(s[i]) - kl; kr++)
{
string str = "";
for (int j = kl; j < sz(s[i]) - kr; j++) str += s[i][j];
if (se.find(str) == se.end()) mp[str]--;
se.insert(str);
}
ans += mp[s[i]];
se.clear();
for (int kl = 0; kl < sz(s[i]); kl++)
for (int kr = 0; kr < sz(s[i]) - kl; kr++)
{
string str = "";
for (int j = kl; j < sz(s[i]) - kr; j++) str += s[i][j];
if (se.find(str) == se.end()) mp[str]++;
se.insert(str);
}
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
9 ms |
384 KB |
Output is correct |
4 |
Correct |
8 ms |
384 KB |
Output is correct |
5 |
Correct |
42 ms |
804 KB |
Output is correct |
6 |
Correct |
69 ms |
768 KB |
Output is correct |
7 |
Correct |
82 ms |
1528 KB |
Output is correct |
8 |
Correct |
127 ms |
2296 KB |
Output is correct |
9 |
Correct |
378 ms |
2440 KB |
Output is correct |
10 |
Correct |
689 ms |
7660 KB |
Output is correct |
11 |
Correct |
576 ms |
4216 KB |
Output is correct |
12 |
Execution timed out |
1083 ms |
16528 KB |
Time limit exceeded |
13 |
Execution timed out |
1085 ms |
2808 KB |
Time limit exceeded |
14 |
Correct |
960 ms |
15096 KB |
Output is correct |
15 |
Execution timed out |
1091 ms |
16444 KB |
Time limit exceeded |
16 |
Execution timed out |
1090 ms |
1144 KB |
Time limit exceeded |
17 |
Correct |
470 ms |
896 KB |
Output is correct |
18 |
Correct |
316 ms |
1008 KB |
Output is correct |
19 |
Execution timed out |
1044 ms |
8824 KB |
Time limit exceeded |
20 |
Correct |
648 ms |
1148 KB |
Output is correct |