# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82890 | Milki | Lozinke (COCI17_lozinke) | C++14 | 286 ms | 16460 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 <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) (int)x.size()
#define pb(x) push_back(x)
typedef long long ll;
typedef pair<int, int> point;
const int MAXN = 2e4 + 5;
string s[MAXN];
unordered_map<string, int> M;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int n; cin >> n;
REP(i, n){
cin >> s[i];
M[s[i]] ++;
}
ll sol = 0;
REP(i, n){
unordered_set<string> S;
REP(j, sz(s[i])){
string x = "";
FOR(k, j, sz(s[i])){
x += s[i][k];
S.insert(x);
}
}
for(auto it : S)
sol += M[it];
}
cout << sol - n;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |