# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223193 | 2020-04-15T04:52:28 Z | jamielim | Trener (COCI20_trener) | C++14 | 23 ms | 640 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD=1000000007; int main(){ int n,k; scanf("%d%d",&n,&k); char str[n][k][55]; for(int i=0;i<n;i++){ for(int j=0;j<k;j++){ scanf("%s",str[i][j]); } } ll dp[n][k]; memset(dp,0,sizeof(dp)); for(int i=0;i<k;i++)dp[n-1][i]=1; for(int i=n-2;i>=0;i--){ for(int j=0;j<k;j++){ for(int m=0;m<k;m++){ bool f=1,s=1; for(int l=0;l<=i;l++){ if(str[i][j][l]!=str[i+1][m][l])f=0; if(str[i][j][l]!=str[i+1][m][l+1])s=0; } if(f||s)dp[i][j]+=dp[i+1][m]; dp[i][j]%=MOD; } } } ll ans=0; for(int i=0;i<k;i++)ans+=dp[0][i]; printf("%lld",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 640 KB | Output is correct |
2 | Correct | 20 ms | 640 KB | Output is correct |
3 | Correct | 20 ms | 640 KB | Output is correct |
4 | Incorrect | 19 ms | 640 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 23 ms | 640 KB | Output is correct |
6 | Correct | 20 ms | 640 KB | Output is correct |
7 | Correct | 20 ms | 640 KB | Output is correct |
8 | Incorrect | 19 ms | 640 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |