| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 44289 | JustInCase | Lozinke (COCI17_lozinke) | C++17 | 641 ms | 17604 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>
#define endl '\n'
using namespace std;
const int32_t MAX_N = 20005;
string passwords[MAX_N];
map< string, bool > currSubstrings;
map< string, int32_t > substringsCnt;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int32_t n;
	cin >> n;
	for(int32_t i = 1; i <= n; i++) {
		cin >> passwords[i];
	}
	for(int32_t i = 1; i <= n; i++) {
		currSubstrings.clear();
		for(int32_t l = 0; l < (int32_t) passwords[i].size(); l++) {
			string curr = "";
			for(int32_t r = l; r < (int32_t) passwords[i].size(); r++) {
				curr += passwords[i][r];
				if(currSubstrings.count(curr) == 0) {
					currSubstrings[curr] = true;
					substringsCnt[curr]++;
				}
			}
		}
	}
	int32_t ans = 0;
	for(int32_t i = 1; i <= n; i++) {
		ans += substringsCnt[passwords[i]] - 1;
	}
	cout << ans << endl;
	return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
