# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
845258 |
2023-09-06T12:51:53 Z |
vjudge1 |
Trener (COCI20_trener) |
C++14 |
|
251 ms |
22324 KB |
#include <bits/stdc++.h>
#define int long long
int MOD = 1e9+7;
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];
hmmm[fr] = hmmm[fr]%MOD;
if( fr != bc ){
hmmm[bc] = (hmmm[bc] + hmmm[ss] )%MOD;
}
}
}
int cnt = 0;
for(int i=0; i<k; i++){
cnt += hmmm[bruh[0][i]];
cnt%=MOD;
}
cout << cnt << "\n";
}
signed main(){
int t=1;
// cin >> t;
while(t--)
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1732 KB |
Output is correct |
2 |
Correct |
10 ms |
1884 KB |
Output is correct |
3 |
Correct |
12 ms |
1884 KB |
Output is correct |
4 |
Correct |
4 ms |
600 KB |
Output is correct |
5 |
Correct |
9 ms |
1372 KB |
Output is correct |
6 |
Correct |
10 ms |
1372 KB |
Output is correct |
7 |
Correct |
5 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
10 ms |
1732 KB |
Output is correct |
6 |
Correct |
10 ms |
1884 KB |
Output is correct |
7 |
Correct |
12 ms |
1884 KB |
Output is correct |
8 |
Correct |
4 ms |
600 KB |
Output is correct |
9 |
Correct |
9 ms |
1372 KB |
Output is correct |
10 |
Correct |
10 ms |
1372 KB |
Output is correct |
11 |
Correct |
5 ms |
604 KB |
Output is correct |
12 |
Correct |
218 ms |
21916 KB |
Output is correct |
13 |
Correct |
222 ms |
21840 KB |
Output is correct |
14 |
Correct |
251 ms |
22324 KB |
Output is correct |
15 |
Correct |
231 ms |
21844 KB |
Output is correct |
16 |
Correct |
51 ms |
5972 KB |
Output is correct |
17 |
Correct |
209 ms |
16740 KB |
Output is correct |
18 |
Correct |
189 ms |
16856 KB |
Output is correct |
19 |
Correct |
187 ms |
16816 KB |
Output is correct |
20 |
Correct |
185 ms |
16700 KB |
Output is correct |
21 |
Correct |
196 ms |
16764 KB |
Output is correct |
22 |
Correct |
54 ms |
6172 KB |
Output is correct |