# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
236867 | DanShaders | Lozinke (COCI17_lozinke) | C++17 | 1085 ms | 2200 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.
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,ssse3,sse4.1,sse4.2,avx,avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define all(x) begin(x), end(x)
#define x first
#define y second
typedef long long ll;
typedef long double ld;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T>
using normal_queue = priority_queue<T, vector<T>, greater<T>>;
multiset<string> data_;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
data_.insert(s);
}
int64_t ans = 0;
for (string s : data_) {
int sz = (int) s.size();
set<string> ss;
for (int j = 0; j < sz; ++j)
for (int h = 1; h <= sz - j; ++h)
ss.insert(s.substr(j, h));
for (string t : ss)
ans += data_.count(t);
}
cout << ans - n << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |