# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341551 | 2020-12-30T01:00:31 Z | A_D | Trener (COCI20_trener) | C++14 | 19 ms | 9068 KB |
/* ID: antwand1 TASK: pprime LANG: C++ */ #include <bits/stdc++.h> #define ll long long #define du long double #define F first #define S second #define FOR(a,b) for(int a=1;a<=b;a++) #define FORl(a,b) for(a=1;a<=b;a++) #define FOR0(a,b) for(int a=1;a<b;a++) #define FORl0(a,b) for(a=0;a<b;a++) #define ii pair<int,int> using namespace std; const int MOD=1e9+7; const int N=55; const int M=1511; string a[N][M]; ll dp[N][M]; string sub[N][M][2]; int n,m; string get(string&s,int l,int r) { string ret; for(int i=l;i<=r;i++)ret+=s[i];return ret; } main() { cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; for(int k=0;k<2;k++){ sub[i][j][k]=get(a[i][j],k,k+i-2); } } } for(int i=1;i<=m;i++)dp[1][i]=1; for(int i=1;i<n;i++){ for(int j=1;j<=m;j++){ for(int x=1;x<=m;x++){ if(a[i][j]==sub[i+1][x][0]||a[i][j]==sub[i+1][x][1])dp[i+1][x]+=dp[i][j]; dp[i+1][x]%=MOD; } } } int ans=0; for(int i=1;i<=n;i++){ ans+=dp[n][i]; ans%=MOD; } cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 8172 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 9068 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 8172 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |