Submission #845240

# Submission time Handle Problem Language Result Execution time Memory
845240 2023-09-06T12:45:37 Z vjudge1 Trener (COCI20_trener) C++14
22 / 110
9 ms 1920 KB
#include <bits/stdc++.h>

using namespace std;

void solve(void){
	int n, k;
	cin >> n >> k;

	vector<vector<string>> bruh(n, vector<string>(k));

	for(int i=0; i<n; i++)
		for(int g=0; g<k; g++)
			cin >> bruh[i][g];

	map<string, int> hmmm;

	for(int g=0; g<k; g++){
		hmmm[ bruh[n-1][g] ] = 1;
	}
	for(int i=n-1; i>0; i--){
		for(int g=0; g<k; g++){
			string ss = bruh[i][g];
			string fr = ss.substr(0, i);
			string bc = ss.substr(1, i);

			hmmm[fr] += hmmm[ss];
			if( fr != bc )
				hmmm[bc] += hmmm[ss];
		}
	}

	int cnt = 0;

	for(int i=0; i<k; i++){
		cnt += hmmm[bruh[0][i]];
	}

	cout << cnt << "\n";
}

int main(){
	int t=1;
//	cin >> t;
	while(t--)
		solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1884 KB Output is correct
2 Correct 9 ms 1920 KB Output is correct
3 Correct 8 ms 1884 KB Output is correct
4 Incorrect 3 ms 604 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 8 ms 1884 KB Output is correct
6 Correct 9 ms 1920 KB Output is correct
7 Correct 8 ms 1884 KB Output is correct
8 Incorrect 3 ms 604 KB Output isn't correct
9 Halted 0 ms 0 KB -