# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
846023 | vjudge1 | Trener (COCI20_trener) | C++98 | 269 ms | 12112 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long a,b,c,d;
string kel;
vector <string > strarr[55];
long long arr[55][1505];
long long mod=1000000007;
memset(arr,0,sizeof(arr));
vector <string> den;
cin>>a>>b;
for(long long i=0;a>i;i++){
for(long long j=0;b>j;j++){
cin>>kel;
strarr[i].push_back(kel);
}
}
for(long long j=0;b>j;j++){
arr[a-1][j]=1;
}
for(long long i=1;a>=i;i++){
for(long long j=0;b>j;j++){
for(long long k=0;b>k;k++){
long long h=0;
for(long long ponk = 0;(a-i)>ponk; ponk++){
if(strarr[a-(i+1)][j][ponk] != strarr[a-(i)][k][ponk]){
h=1;
break;
}
}
if(h == 1){
h=0;
for(long long ponk = 0;(a-i)>ponk; ponk++){
if(strarr[a-(i+1)][j][ponk] != strarr[a-(i)][k][ponk+1]){
h=1;
break;
}
}
if(h == 0){
arr[(a-(i+1))][j]=((arr[(a-(i))][k] % mod) + (arr[(a-(i+1))][j] % mod)% mod);
}
}
else{
arr[(a-(i+1))][j]=((arr[(a-(i))][k] % mod) + (arr[(a-(i+1))][j] % mod)% mod);
}
}
}
}
d=0;
for(long long j=0;b>j;j++){
d+=arr[0][j];
d%=mod;
}
cout<<d%mod;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |