# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
219383 |
2020-04-05T08:21:39 Z |
Vimmer |
Trener (COCI20_trener) |
C++14 |
|
136 ms |
1272 KB |
#include <bits/stdc++.h>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define sz(x) ll(x.size())
#define pb push_back
#define N 75005
#define M ll(1e9 + 7)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef short int si;
map <string, ll> dpl, dp;
int main()
{
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, k;
cin >> n >> k;
vector <string> b(k);
dp.clear(); dpl.clear();
for (register int i = 0; i < k; i++) {string str; cin >> str; dpl[str]++;}
for (register int i = 1; i < n; i++)
{
for (register int j = 0; j < k; j++)
{
string str1, str2;
cin >> b[j];
str1 = b[j].substr(0, i);
str2 = b[j].substr(1);
ll sm = dpl[str1];
if (str1 != str2) sm = (sm + dpl[str2]) % M;
dp[b[j]] += sm;
dp[b[j]] %= M;
}
dpl = dp;
dp.clear();
}
ll ans = 0;
for (auto it : dpl) ans = (ans + it.S) % M;
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
384 KB |
Output is correct |
3 |
Correct |
11 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
11 ms |
384 KB |
Output is correct |
6 |
Correct |
10 ms |
384 KB |
Output is correct |
7 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
10 ms |
384 KB |
Output is correct |
6 |
Correct |
10 ms |
384 KB |
Output is correct |
7 |
Correct |
11 ms |
384 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
11 ms |
384 KB |
Output is correct |
10 |
Correct |
10 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
121 ms |
1272 KB |
Output is correct |
13 |
Correct |
120 ms |
1248 KB |
Output is correct |
14 |
Correct |
123 ms |
1236 KB |
Output is correct |
15 |
Correct |
122 ms |
1272 KB |
Output is correct |
16 |
Correct |
22 ms |
512 KB |
Output is correct |
17 |
Correct |
122 ms |
1016 KB |
Output is correct |
18 |
Correct |
125 ms |
1144 KB |
Output is correct |
19 |
Correct |
121 ms |
1148 KB |
Output is correct |
20 |
Correct |
123 ms |
1016 KB |
Output is correct |
21 |
Correct |
136 ms |
1016 KB |
Output is correct |
22 |
Correct |
24 ms |
512 KB |
Output is correct |