Submission #845240

#TimeUsernameProblemLanguageResultExecution timeMemory
845240vjudge1Trener (COCI20_trener)C++14
22 / 110
9 ms1920 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...