Submission #82890

#TimeUsernameProblemLanguageResultExecution timeMemory
82890MilkiLozinke (COCI17_lozinke)C++14
100 / 100
286 ms16460 KiB
#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 timeMemoryGrader output
Fetching results...