Submission #846034

# Submission time Handle Problem Language Result Execution time Memory
846034 2023-09-07T07:18:11 Z vjudge1 Trener (COCI20_trener) C++
0 / 110
3 ms 1372 KB
#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;
	cin>>a>>b;
	long long arr[a + 5][b + 5];
	string strarr[a + 5][b + 5];
	long long mod=1000000007;
	memset(arr,0,sizeof(arr));
	for(long long i=0;a>i;i++){
		for(long long j=0;b>j;j++){
			cin>>strarr[i][j];
		}
	}
	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=((d% mod)+ (arr[0][j] % mod)) % mod;
	}
	cout<<d;


	
}

Compilation message

trener.cpp: In function 'int main()':
trener.cpp:6:16: warning: unused variable 'c' [-Wunused-variable]
    6 |  long long a,b,c,d;
      |                ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1372 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -