# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223289 | 2020-04-15T06:51:46 Z | dantoh000 | Trener (COCI20_trener) | C++14 | 17 ms | 4352 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1000000007; int n,k; unordered_map<string,int> ct; string a[55][1505]; int main(){ scanf("%d%d",&n,&k); for (int i = 1; i <= n; i++){ for (int j = 1; j <= k; j++){ cin >> a[i][j]; } } ll ans = 0; ct[""]++; for (int i = 1; i <= n; i++){ for (int j = 1; j <= k; j++){ string X = a[i][j].substr(1); string Y = a[i][j].substr(0,a[i][j].size()-1); //cout << a[i][j] << " " << X << " " << Y; int res = ct[X]; if (X != Y) res += ct[Y]; //printf("%d %d\n",ct[X],ct[Y]); ct[a[i][j]] += res; ct[a[i][j]] %= mod; if (i == n) ans += res; } } printf("%d",ans%mod); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2944 KB | Output is correct |
2 | Correct | 6 ms | 2944 KB | Output is correct |
3 | Correct | 6 ms | 2944 KB | Output is correct |
4 | Correct | 6 ms | 2944 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 4224 KB | Output is correct |
2 | Correct | 17 ms | 4352 KB | Output is correct |
3 | Correct | 17 ms | 4352 KB | Output is correct |
4 | Correct | 15 ms | 3328 KB | Output is correct |
5 | Incorrect | 16 ms | 4096 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2944 KB | Output is correct |
2 | Correct | 6 ms | 2944 KB | Output is correct |
3 | Correct | 6 ms | 2944 KB | Output is correct |
4 | Correct | 6 ms | 2944 KB | Output is correct |
5 | Correct | 17 ms | 4224 KB | Output is correct |
6 | Correct | 17 ms | 4352 KB | Output is correct |
7 | Correct | 17 ms | 4352 KB | Output is correct |
8 | Correct | 15 ms | 3328 KB | Output is correct |
9 | Incorrect | 16 ms | 4096 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |