Submission #1173929

#TimeUsernameProblemLanguageResultExecution timeMemory
1173929nuutsnoyntonVještica (COCI16_vjestica)C++20
0 / 160
77 ms102472 KiB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const ll N = 1e6 + 2;
ll node_cnt = 0;
ll trie[N][30] = {0}; 


void add_string(string str) {
	ll node = 0;
	for (int i = 0; i < str.size(); i ++) {
		if ( trie[node][str[i] - 'a'] == 0) {
			trie[node][str[i] - 'a'] = ++node_cnt;
		}
		node = trie[node][str[i] - 'a'];
	}
}

int main() {
	ll n, m, r, x, y, i, j, ans, t;
	
	cin >> n;
	
	for (i = 1; i <= n; i ++) {
		string str;
		
		cin >> str;
		sort(str.begin(), str.end());
		
		add_string(str);
	}
	cout << node_cnt + 1 << endl;
	
	
}
#Verdict Execution timeMemoryGrader output
Fetching results...