Submission #740507

# Submission time Handle Problem Language Result Execution time Memory
740507 2023-05-12T15:41:30 Z vjudge1 Trener (COCI20_trener) C++14
55 / 110
2000 ms 31172 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mod 1000000007
#define N 55
#define K 15005
string kelime[N][K];
ll int kactaneyol[N][K];
 
int main(){
  lalala;
  int n,k;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    for(int j=0;j<k;j++){
        string a;cin>>a;
        kelime[i][j]=a;
    }
  }
  for(int i=0;i<k;i++)kactaneyol[0][i]=1;
  for(int i=0;i<n-1;i++){
    for(int j=0;j<k;j++){
      //cout<<kactaneyol[i][j]<<" ";
      string str=kelime[i][j];
      for(int jx=0;jx<k;jx++){
        string s=kelime[i+1][jx][0]+str, t=str+kelime[i+1][jx][i+1];
        if(s==kelime[i+1][jx]|| t==kelime[i+1][jx] ){
          kactaneyol[i+1][jx]+=kactaneyol[i][j];
          kactaneyol[i+1][jx]%=mod;
        }
      }
    }//cout<<endl;
  }
  ll int cev=0;
  for(int i=0;i<k;i++){
    //cout<<kactaneyol[n-1][i]<<" ";
    cev+=kactaneyol[n-1][i];
    cev%=mod;
  }
  cout<<cev<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 26152 KB Output is correct
2 Correct 13 ms 26168 KB Output is correct
3 Correct 14 ms 26168 KB Output is correct
4 Correct 15 ms 26152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 26684 KB Output is correct
2 Correct 65 ms 26712 KB Output is correct
3 Correct 64 ms 26688 KB Output is correct
4 Correct 55 ms 26612 KB Output is correct
5 Correct 54 ms 26580 KB Output is correct
6 Correct 57 ms 26684 KB Output is correct
7 Correct 54 ms 26696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 26152 KB Output is correct
2 Correct 13 ms 26168 KB Output is correct
3 Correct 14 ms 26168 KB Output is correct
4 Correct 15 ms 26152 KB Output is correct
5 Correct 69 ms 26684 KB Output is correct
6 Correct 65 ms 26712 KB Output is correct
7 Correct 64 ms 26688 KB Output is correct
8 Correct 55 ms 26612 KB Output is correct
9 Correct 54 ms 26580 KB Output is correct
10 Correct 57 ms 26684 KB Output is correct
11 Correct 54 ms 26696 KB Output is correct
12 Execution timed out 2056 ms 31172 KB Time limit exceeded
13 Halted 0 ms 0 KB -