# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
530951 | 2022-02-27T08:01:14 Z | Tenis0206 | Trener (COCI20_trener) | C++11 | 476 ms | 3608 KB |
#include <bits/stdc++.h> using namespace std; const int Mod = 1e9 + 7; int n,k; int dp[1505]; string s[1505]; map<string,int> dps; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>k; for(int j=1;j<=k;j++) { cin>>s[j]; ++dps[s[j]]; } for(int i=2;i<=n;i++) { for(int j=1;j<=k;j++) { dp[j] = 0; } for(int j=1;j<=k;j++) { cin>>s[j]; for(int st=0;st<s[j].size();st++) { string aux; for(int dr=st;dr<s[j].size();dr++) { aux.push_back(s[j][dr]); dp[j] += dps[aux]; dp[j] %= Mod; } } } dps.clear(); for(int j=1;j<=k;j++) { dps[s[j]] += dp[j]; dps[s[j]] %= Mod; } } int rez = 0; for(int j=1;j<=k;j++) { rez += dp[j]; rez %= Mod; } cout<<rez<<'\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Incorrect | 1 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 476 ms | 3608 KB | Output is correct |
2 | Correct | 465 ms | 2944 KB | Output is correct |
3 | Correct | 474 ms | 3380 KB | Output is correct |
4 | Incorrect | 88 ms | 460 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Incorrect | 1 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |